see on GitHub

Session: Querying: How to use search?

More complex text searching can be achieved by using search extension method. This method allows you to pass one or more search terms that will be used in searching process for a particular field (or fields).

Syntax

public IRavenQueryable<T> search(Path<?> fieldSelector, String searchTerms);

public IRavenQueryable<T> search(Path<?> fieldSelector, String searchTerms, double boost);

public IRavenQueryable<T> search(Path<?> fieldSelector, String searchTerms, double boost, SearchOptionsSet searchOptions);

public IRavenQueryable<T> search(Path<?> fieldSelector, String searchTerms, double boost, SearchOptionsSet searchOptions, EscapeQueryOptions escapeQueryOptions);

Parameters
fieldSelector Path Expression marking a field in which terms should be looked for.
searchTerms String Space separated terms e.g. 'John Adam' means that we will look in selected field for 'John' or 'Adam'.
boost double Boost value. Default: 1.
options SearchOptions Explicitly set relation between each Search functions. One of the following: Or, And, Not, Guess. Default: SearchOptions.Guess.
escapeQueryOptions EscapeQueryOptions Terms escaping strategy. One of the following: EscapeAll, AllowPostfixWildcard, AllowAllWildcards, RawQuery. Default: EscapeQueryOptions.EscapeAll.
Return Value
IRavenQueryable Instance implementing IRavenQueryable interface containing additional query methods and extensions.

Example I

QHowToUseSearch_User u = QHowToUseSearch_User.user;
List<User> users = session
  .query(User.class, "Users/ByNameAndHobbies")
  .search(u.name, "Adam")
  .search(u.hobbies, "sport")
  .toList();

Example II

QHowToUseSearch_User u = QHowToUseSearch_User.user;
List<User> users = session
  .query(User.class, "Users/ByNameAndHobbies")
  .search(u.hobbies, "I love sport", 10)
  .search(u.hobbies, "but also like reading books", 5)
  .toList();