RavenDB version 2.0. Other versions:

Lucene queries example

Syntax

http://lucene.apache.org/core/old_versioned_docs/versions/2_9_4/queryparsersyntax.html

Looking for words

In case we want to find all documents with property Text containing some word.

Text:Word

Looking for phrases

In case we want to find all documents with property Text containing specified sentence.

Text:"several words"

DateTime ranges

Take a look at these tests.

http://github.com/ravendb/ravendb/commit/721c50ea51ff7721928cca76de957e9f7d9e3786

How can I query for a null value?

Let us say that we want to find all users that didn't provide their email. This is the query that we will need to issue:

Email:[[NULL_VALUE]]

The [[ ]] denotes and NotAnalyzed value, and Raven writes NULL_VALUE to the Lucene index when it encounters a null being indexed.

Comments add new comment

The comments section is for user feedback or community content. If you seek assistance or have any questions, please post them at our support forums.

Andrew Harry
REPLY Posted by Andrew Harry on

Don't forget you can query for empty strings with [EMPTY_STRING]

Khalilov
REPLY Posted by Khalilov on

A note for other extreme beginners like myself for the AND operator, if you wish to apply the AND operator to a specific query (Correct):

Message: hello AND Message: hi

I thought it was supposed to be (Wrong):

Message: hello AND hi

SUBMIT COMMENT