ravendb combining Search with Where

full-text-search, ravendb

Solution

Thanks to @Tobias on Raven@GoogleGroups who pointed me in the right direction - there was an option to define how the Where and Search clauses would be combined:

Query<T>.Search(candidate => candidate.MessageBody, queryString + "*", options: SearchOptions.And);

Problem

I am executing a raven query in C#, and utilising both the Where() and Search() extension methods. I need both these functionalities, because I need to only return indices with a specific Guid field, AND text that exists in a body of text. Unfortunatly, the Where extension method seems to not be compatible with the Search extension method. When I combine them I get a Lucene query like this: ``` Query: FeedOwner:25eb541c\-b04a\-4f08\-b468\-65714f259ac2 MessageBody:<<request*>> ``` Which seems to completely ignore the 'MessageBody' part of the criteria - so it doesnt matter what constraint I use in the 'free text', it doesnt use it. I have tested with the 'Search' alone, and it works - so its not a problem with free-text searching by itself - just combining the two.

Original source