[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();
var searchQuery = searchCriteria.NodeTypeAlias("StandardContent");
searchQuery.And().Field("title", model.Article);
var searchResults = searcher.Search(searchQuery.Compile());
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;
}
The search query is what is but here is the output. See image below.
My main problem is when I search what all posts that starts word what is displaying, but when I search what is the output should be start also with what is the my output still the same.
But when I search the complete posts name *e.g. What is Piering?* it works fine!
But I want is like autocomplete search, like when they are searching for What is keyword, and display all posts that started this keyword.
Examine Search not working properly
Hi,
I need help about examine search query.
Here is my code:
The search query is
what is
but here is the output. See image below.Appreciate any help and ideas.
Thanks
Jin
Hi Jin,
Can you point out what is not working. That is not clear from your post.
Dave
Hi Dave,
Oops, sorry!
My main problem is when I search
what
all posts that starts word what is displaying, but when I searchwhat is
the output should be start also withwhat is
the my output still the same.But when I search the complete posts name *e.g. What is Piering?* it works fine!
But I want is like autocomplete search, like when they are searching for
What is
keyword, and display all posts that started this keyword.Hope, I explain well.
Thanks
Jin
Hi Jin,
Probably the links in this postcan get you started : https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/92880-examine-autocomplete-suggest
Dave
Hi Dave,
I want to ask, how can I create
spellchecker
file?Thanks
Jin
is working on a reply...