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 174 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 353 karma points
    Jun 25, 2019 @ 07:11
    Mila Pandurska
    103

    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 174 karma points
    Jun 25, 2019 @ 11:24
    Raluca Dumitru
    0

    Brilliant. Thank you :)

Please Sign in or register to post replies

Write your reply to:

Draft