I would like a autocomplete function with Examine, which should work in a way that when I write "What is" it suggests
"What is Piering ""What is soil testing""What is roof sarking?"
But what I've done is when I write "What is" it suggests all my posts that starts the word "What". See screenshot below.
Here is my code;
[System.Web.Http.HttpPost]
public List<Article> GetArticles(SearchArticleModel model)
{
var result = new List<Article>();
if (!string.IsNullOrEmpty(model.Article))
{
var searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
var searchCriteria = searcher.CreateSearchCriteria();
// Find posts that contain our search text in either nodeName or title
var searchQuery = searchCriteria.Field("nodeName", model.Article.Boost(8)).Or().Field("title", model.Article.Boost(5)).Compile();
var searchResults = searcher.Search(searchQuery);
foreach (var searchResult in searchResults)
{
var articles = new Article()
{
Id = Convert.ToInt32(searchResult.Id),
Name = searchResult.Fields["title"],
};
articles.Url = articles.Id.TypedContent().Url ?? string.Empty;
result.Add(articles);
}
return result;
}
return result;
}
Here is what I've done, I add MultipleCharacterWildcard() because I read in your post regarding this extension. Link.
// Find posts that contain our search text in title
searchCriteria.NodeTypeAlias("StandardContent").And().Field("title", model.Article.MultipleCharacterWildcard()).Compile();
I haven't read your post regarding on how to implement autocomplete, can you give the link? I really need help for this, since I'm new in Umbraco.
Can you give me some ideas or what is the exact query to get the whole phrase, because as I read in other blogs that when *symbol is in the last it means, it will show all post that starts whatever you've enter on the search box. e.g. title:foo *
Last question, can you tell me where I can create this spellchecker public class SpellCheckIndexer : BaseUmbracoIndexer. I am really new in Umbraco, and I don't know where I can create this stuff.
How to create Examine AutoComplete ?
Hi, Good day!
I would like a autocomplete function with Examine, which should work in a way that when I write
"What is"
it suggests"What is Piering "
"What is soil testing"
"What is roof sarking?"
But what I've done is when I write
"What is"
it suggests all my posts that starts the word"What"
. See screenshot below.Here is my code;
Did I miss something?
Any ideas or snippet
Thanks,
Marky
Marky,
Can you write out the generated query I suspect the word 'is' is being stripped out as it is a stop word and you are using standard analyser.
Regards
Ismail
Hi Ismail,
Thanks for your response.
I am new in Umbraco, can you tell me how I can generate the query?
Thanks,
Marky
Hi Ismail,
It might be the query?
Thanks,
Marky
you can see its stripping stop word "is" proof of this can be seen by using luke see image below:
I have done auto complete before but matching on single words, it was a combination of building a spellchecker index then doing the auto complete search on that. See on how to build spellchecker index http://blog.aabech.no/archive/building-a-spell-checker-for-search-in-umbraco/ you then have to create an autocomplete analyser that creates ngrams and you then search on that index. I used this stackoverflow post to get to that point https://stackoverflow.com/questions/120180/how-to-do-query-auto-completion-suggestions-in-lucene specifically this part which is c# port of some java code https://stackoverflow.com/a/9183416/719625
Hi Ismail,
Thanks for your help, I will look into it.
Regards,
Marky
Hi Ismail,
Here is what I've done, I add MultipleCharacterWildcard() because I read in your post regarding this extension. Link.
Here is the update query
But I got no results.
But here is the data that suppose to be displayed.
But still no luck, and don't know what's the next step.
Thanks
Marky
Marky,
Its not wildcard issue, did you take a look at my previous post with links on how to implement autocomplete? Also I only got it working single word.
Regards
Ismail
Hi Ismail,
Thanks for your reply.
I haven't read your post regarding on how to implement autocomplete, can you give the link? I really need help for this, since I'm new in Umbraco.
Can you give me some ideas or what is the exact query to get the whole phrase, because as I read in other blogs that when *symbol is in the last it means, it will show all post that starts whatever you've enter on the search box. e.g. title:foo *
I'm stuck on this.
Thanks,
Marky
this earlier post https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/94672-how-to-create-examine-autocomplete#comment-299482
Ohh, Okay.
This can't be done by using only Examine Search?
Thanks,
Marky
Hey Ismail,
Last question, can you tell me where I can create this spellchecker
public class SpellCheckIndexer : BaseUmbracoIndexer
. I am really new in Umbraco, and I don't know where I can create this stuff.Thanks in advance,
Marky
is working on a reply...