Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jin Botol 134 posts 287 karma points
    Nov 10, 2018 @ 04:02
    Jin Botol
    1

    Examine Search not working properly

    Hi,

    I need help about examine search query.

    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();
            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.

    enter image description here

    Appreciate any help and ideas.

    Thanks

    Jin

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Nov 10, 2018 @ 09:42
    Dave Woestenborghs
    0

    Hi Jin,

    Can you point out what is not working. That is not clear from your post.

    Dave

  • Jin Botol 134 posts 287 karma points
    Nov 12, 2018 @ 06:47
    Jin Botol
    0

    Hi Dave,

    Oops, sorry!

    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.

    Hope, I explain well.

    Thanks

    Jin

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Nov 12, 2018 @ 07:08
    Dave Woestenborghs
    0

    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

  • Jin Botol 134 posts 287 karma points
    Jan 08, 2019 @ 07:55
    Jin Botol
    0

    Hi Dave,

    I want to ask, how can I create spellchecker file?

    Thanks

    Jin

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies