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
    Aug 21, 2018 @ 09:33
    Jin Botol
    0

    Multiple Search with Examine

    Hi all,

    Any ideas on how to apply multiple search in Examine.

    What I've done is.

    var searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
    var searchCriteria = searcher.CreateSearchCriteria();
    
    var searchQuery = searchCriteria.NodeTypeAlias("Product");
    
    var searchResults = searcher.Search(searchQuery.Compile());
    

    All I want to do is, for example.. when user select for 2 Bedrooms & 2 Bathrooms. I already get the data which the user inputs

    model.Beds // 2 output
    model.Baths //2 output
    

    How can I insert this in Examine as a Query?

    Thanks in advance!

    Cheers,

    Jin

  • Jin Botol 134 posts 287 karma points
    Aug 22, 2018 @ 03:23
    Jin Botol
    0

    I've tried.

    var searchQuery = searchCriteria.NodeTypeAlias("Product").And().Field("bedrooms", model.Beds).And().Field("bathrooms", model.Baths).And();
    

    But still no luck, it gives a Null Exception error.

    Any helps?

    thanks

  • Barry 15 posts 56 karma points c-trib
    Aug 22, 2018 @ 14:21
    Barry
    0

    Not sure that you need the .And() at the end.

    Also, I would look to create a new Index with minimal fields that you either only want to search on or output.

    There's a great article from a great website that should help you along

    https://24days.in/umbraco-cms/2013/getting-started-with-examine/

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Aug 22, 2018 @ 09:44
    Dave Woestenborghs
    0

    Hi Jin,

    What part of the code is giving the null reference exception ?

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft