{exp:search:keywords} filtering out insignificant words - expressionengine

With my current project I need to display the exact search phrase entered on the results/no-results pages.
However the {exp:search:keywords} variable seems to have insignificant keywords removed.
“Who am I?” becomes “who am”
I understand why this is the case but for the purposes of this particular website I need the exact phrase.
Does anyone know how I can achieve this ? Please let there be a workaround...
I am using the Simple Search module in 2.7.0
Thanks.

/system/expressionengine/modules/search/mod.search.php:236 (v2.7.0)
//$original_keywords = $this->keywords;
$original_keywords = $_POST['keywords'];

Related

No result if search contains dot and wildcard

I use azure search and have some document with a field like this {"Nr": "123.334.93"}.
If i search for querytype=full&search=123.334.93 then it found multiple document and if I search for querytype=full&search="123.334.93" then it found one document. This is as expected.
But if I search for querytype=full&search=123.334.9* I expect multiple document starting with 123.334.9 but none result are given back.
Do I miss somthing?
The same is when I use a regex expression like this querytype=full&search=/123\.334\.9.*/
Your query looks correct to me and should work.
A couple of things you might look into.
1) Sometimes you need to escape the * like this:
querytype=full&search=123.334.9\*
Usually, this is only necessary if you have more search terms after the *.
2) You can also narrow the fields searched down to only the field you need (for better efficiency) like this:
querytype=full&search=Nr:123.334.9\*
Hope this helps.
Based on the Comment from Yahnoosh.
The analyzer of the field was set to "de.microsoft". I change that to "standard.lucene", recreate and fill the index and it works as expected.
It seems that I have to be more carefully to set the analyzer and only use specific ones for fields with language specific content.
Thanks for your help.

Wikipedia wildcard search not working?

I'm trying to do a wildcard search on Wikipedia but the search is not behaving the way the instructions say it should. Here's the advanced search help page:
https://en.wikipedia.org/wiki/Help:Advanced_search
As an example, it says this regarding a Wildcard search:
the query *stan will match Kazakhstan or Afghanistan or Stan Kenton.
However, when I attempt to do that search (or even click on the embedded link to that search), I only get
the page *stan does not exist
and it just lists a bunch of "Stan" entries starting with "Stan Laurel filmography."
Why would this feature not work? Am I missing something?
It does work, however because direct matches for "stan" are scored higher than words with it, Kazakhstan is waaaay down in results. You can try slightly narrowing the results with intitle:*stan however this is still bad. However, a quick check with k*stan shows that it works.
Conclusion: user-written help page has a bad example.

Searching Single Pages with Dynamic Content

I have a slight problem I have been trying to address for a client I have been working with. We have 4 sets of single pages that are loading content from a database using PHP based upon a get string that is provided. These pages that are generated are optimized well for SEO and have alt tags for images and Content that we need to be able to search using a search feature.
Now i had assumed (An everyone knows what assuming gets you) that these pages by default would be able to be searched by the concrete 5 built in search feature. But it doesn't work. If I search for a word that I know is definitely on one of these pages even multiple times no results are found.
How can I make Concrete5 search these pages. If its no do able by a default or by a plugin, then can someone please offer some advice on how to fix this. This is an important feature and must be completed.
EDIT: See my comment below. I still need some help or direction here as CSE inst much of an option.
EDIT2: It may be viable for me to install a crawler and a custom search engine to address my problems. I was thinking of spider. Any other suggestions on that or other options are much appreciated!
Unfortunately C5 doesn't provide a way to do this -- the only way to tap into the search index is with blocks. And even if you created a phony block just to pass content from the single_page through to the search index, there's no way to say that some content is from one URL while other content is from another URL (which you'd need to do since your single_page controller is handling many different URL's).
I don't know of a way to achieve what you want to do (and it appears that nobody else does either -- http://www.concrete5.org/community/forums/customizing_c5/make-content-in-single-pages-searchable/ ), other than building your own internal search engine.
EDIT: I just did some digging, and thought that perhaps you could manually insert records into the PageSearchIndex table and specify the searchable content and the desired path there -- but this won't work because it relies on one cID (collection id, a.k.a. page id) per entry -- so you'd only be able to insert one record for the top-level single_page path.
I think the simplest solution here would be to create your own searching infrastructure for your single_pages (like some kind of function in the controller that would return an array of page paths and searchable content for each one), then override the search block and perform an additional search of your single_page -- then combine the results on the search results page there. Or just use google site search for your site, which will actually crawl the pages and hence find your various single_page urls: https://www.google.com/cse/
Best of luck.
I have not tested this, but maybe you can put a function getSearchableContent() in the single pages controller like you do for blocks. This would return the string to be searched. Would look something like this:
function getSearchableContent() {
// ... compose searchstring depending on the queried content.
return $searchstring;
}
But I don't know if this works for dynamic content. If not, I'd look into C5's search index core classes and try to extend them for your project.

how to display spelling suggestion in sharepoint search

how can I get spelling suggestion in shaerpoint search ,
I use
query.EnableSpellcheck = SpellcheckMode.Suggest;
then get the value of property
SpellingSuggestion
of the ResultTableCollection
but I'm not getting any spelling correction if I entered incorrect search keyword
any ideas please ???
I may be a little late to answer, were you able to find the solution?
The answer of your question depends if you want to get suggestions or you want spelling auto-correction.
When you use the following:
query.EnableSpellcheck = SpellcheckMode.Suggest;
FAST will try to find the correct terms in your search query if you did a typo in your search or misspelled something. The results of this suggestion will be in an extendedProperty of the dataset you get as result of your query. No need to fill-up a suggestions dictionnary, FAST provides already a quite big dictionnary of suggestions out-of-the-box.
If what you want is an auto-correction, meaning that your search terms will be corrected, and FAST will do a new search with those new terms, you need that:
query.EnableSpellcheck = SpellcheckMode.On;
Of course, the remaining option if you don't want suggestions nor auto-correction, you specify:
query.EnableSpellcheck = SpellcheckMode.Off;
Or, you don't specify anything, because Off is the default value.

Solr not matching. Threshold setting, or something weird?

I'm using solr to search for articles. I created 2 test "body" sentences which have the common word "tall", but there is no match.
The Query---> Body:"There are tall people outside" AND !UserId:2
Does not match a post with:
Body: the KU tower is really tall
UserId:3
Is this just simply a very low matching score? or is there something else going on here? In the case of a low matching score should it really be that low? The body sentences are very short and share a common word, I would have expected some match.
EDIT: I think the matching isn't happening as a result of having the !UserId: 2 condition. If I try to match body sentences without that, its very liberal. Can anyone explain this? and perhaps how to best structure a query to avoid this type of specific behavior?
Thanks!
I have seen some funky behavior with the ! operator with Solr. I would suggest you use the - (negative indicator) instead as shown in the SolrQuerySyntax Wiki Page. Try changing your original query to Body:"There are tall people outside" AND -UserId:2 to see if that works as you are expecting.
For those who come after me, I found a solution however not necessarily an explanation for its behavior.
The Solr query:
(PostBody:There are tall people outside) AND !UserId:2
worked as I desired above. Note that if the quotes are added around the body, it does not match. I believe Solr attempts to match such a query as a single string rather than individual words.

Resources