Copied to clipboard

Flag this post as spam?

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


  • Raluca Dumitru 33 posts 173 karma points
    Jun 17, 2019 @ 15:32
    Raluca Dumitru
    0

    Examine multiple fields search

    Hi everyone.

    Does anybody knows how to search multiple fields with Examine? This is my code for one field , but it would be great if I could search the title as well.

    var results = searcher.CreateQuery("content").NodeTypeAlias("topic").And().Field("topicBody", searchTerm).Execute();
    

    Thank you

  • Mila Pandurska 75 posts 350 karma points
    Jun 25, 2019 @ 07:11
    Mila Pandurska
    101

    Hi, Raluca, you can search in multiple field using the following query:

    var textFields = new[] { "title", "description",  "content", .... };
    var results = searcher.CreateQuery("content").NodeTypeAlias("topic").And().GroupedOr(textFields, searchTerm).Execute();
    

    I hope that this helps Mila

  • Raluca Dumitru 33 posts 173 karma points
    Jun 25, 2019 @ 11:24
    Raluca Dumitru
    0

    Brilliant. Thank you :)

  • 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