Copied to clipboard

Flag this post as spam?

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


  • André Lange 108 posts 410 karma points
    Apr 23, 2020 @ 12:58
    André Lange
    0

    Examine search return no results

    In Umbraco 8 i am trying to get search to work. I have followed the documentation, but i am givin no result. If i test searching in the backoffice, it works fine.

    My search code:

    if (ExamineManager.Instance.TryGetIndex("ExternalIndex", out var index))
                {
                    var searcher = index.GetSearcher();
    
                    var results = searcher.CreateQuery("content", BooleanOperation.Or)
                                            .Field("pageTitle", searchTerm)
                                            .Or().Field("subPagetitle", searchTerm)
                                            .Or().Field("grid", searchTerm)
                                            .Execute();
                    var r = results;
    
                }
    

    Can anyone see what i am doing wrong ?

  • mmaty 99 posts 228 karma points
    Dec 17, 2020 @ 11:32
    mmaty
    0

    Did you find a solution for this problem?

    I tried the simplest possible solution:

    var examineManager = Current.Factory.GetInstance<IExamineManager>();
    IIndex index;
    if (!examineManager.TryGetIndex( "ExternalIndex", out index ))
    {
        return null;
    }
    
    return index.GetSearcher().Search( searchString );
    

    This is exactly the code used by the Umbraco ExamineManagementController. But it doesn't give me any results. In the backoffice the queries work, but my code doesn't. If I use the same code with the InternalIndex, it works.

Please Sign in or register to post replies

Write your reply to:

Draft