You are currently browsing legacy 4.1 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

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)