how to display spelling suggestion in sharepoint search - sharepoint

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.

Related

How do I check if certain text exists on a page (puppeteer)

Sorry in advance if I seem kinda clueless, I just started using puppeteer yesterday and I’m inexperienced with this kinda stuff.
I’m trying to check if a certain page (opened with puppeteer) has the phrase “hello” for example, keep in mind that I know the XPath of the text (if it exists). I’ve tried .waitForXPath() but I can’t seem to get it to work. Is there an easier function for this?
(await page.content()).match('hello')
That depends on what you typed into .waitforXPath() method.
I can imagine this can work:
await page.waitForXPath("//*[contains(text(), 'hello')]");
But it might be slow because all texts of all elements will be searched. It's better to narrow down the search to e.g. some elements. Unfortunately you don't provide more specifics, so I can't help you there.

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.

{exp:search:keywords} filtering out insignificant words

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'];

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.

Setting a TextFilter's value from a Query String (URL) Filter

I'd like to start off by saying I'm very new to Sharepoint, so I'm sorry if I'm asking something very obvious. I've done quite a bit a googling and can't find an answer to my question. This leads me to believe that maybe I'm asking the wrong question. So, here goes:
We have a Sharepoint webpage that currently contains 3 Web Parts (2 lists and a text filter). The text filter can be used to filter the two lists. I've been asked to provide the following functionality:
A user must be able to open this page from an http link (easy)
The Text-Filter must be automatically filled-in and applied, thus immediately filtering the two lists
This seemed pretty straight-forward to me: Pull a parameter from the page's URL and feed it into the filter.
I found and added a Query String (URL) Filter and I managed to pull the parameter from the URL, but I can't feed it to the existing Filter!
Sure, I can pass the value to the two lists (effectively coding the same filter two different ways) but that seems wrong. So, my question boils down to this:
Is it possible to set a Text Filter's value from a Query String (URL) Filer?
Am I asking the wrong question? Am I looking at this problem in the wrong way? Any help is much appreciated, thanks.
I was asking the wrong question!
It seems you can set a Text Filter's value on page-load through the URL. Here's how:
http://sharepoint-server/site/subsite/project/default.aspx?Text%20Filter%20Name=999
Where Text%20Filter%20Name is the name of your Text Filer (in this case, with spaces in the name), and where 999 is the value you're passing to the filter.

Resources