Session: Querying: How to Perform Proximity Search

To find words within a specific distance away use proximity method. This method is available only from DocumentQuery level and can only be used right after search method.

Syntax

IDocumentQuery<T> proximity(int proximity);
Parameters
proximity int Number of words within.

Example

session
    .advanced()
    .documentQuery(Fox.class)
    .search("name", "quick fox")
    .proximity(2)
    .toList();
from Foxes
where proximity(search(Name, 'quick fox'), 2)