Copied to clipboard

Flag this post as spam?

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


  • Nick Bloodworth 23 posts 96 karma points
    May 31, 2023 @ 11:48
    Nick Bloodworth
    0

    Searching from multiple drop downs

    Whats the best way to make a multi drop down search box, like the ones used to search for properties on RightMove?

    The documentation I've seen for Examine don't show what I want.

    Nick

  • Marcio Goularte 389 posts 1362 karma points
    May 31, 2023 @ 14:57
    Marcio Goularte
    0

    Hi Nick,

    This scenario you describe is possible be made by custom query

    https://docs.umbraco.com/umbraco-cms/reference/searching/examine/quick-start#creating-the-search-query

    string drop1Value = "test1"; //or another type you are using
    string drop2Value = "test2"; //or another type you are using
    
    if (_examineManager.TryGetIndex("ExternalIndex", out IIndex? index))
                    {
                        var result = index.Searcher.CreateQuery("content").NodeTypeAlias("myDocumentAlias")
                           .And()
                           .Field("property1", drop1Value)
                           .And()
                           .Field("property2", drop2Value)
                           .Execute();
                    }
    

    Something more or less like this. If you need more help, show the code

  • 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