Newer Versions

2.1
v2.0
v1.8

Older Versions

v1.6
v1.5

LucidWorks Enterprise v1.7

Other Resources

Support Forums

This is the documentation for LucidWorks Enterprise v1.7. The latest version is 2.1.

compared with
Current by Cassandra Targett
on Mar 28, 2011 08:20.

(show comment)
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (13)

View Page History
{{"John Doe"~2}} matches {{"John Doe"}} and {{"Doe, John"}}, as well as {{"John Q. Doe"}}

h34. Advanced Proximity Operators

The Lucid query parser also supports advanced proximity query operators to specify more elaborate sequences of terms and to control the order of terms and how many intervening terms are permitted. The advanced proximity operator keywords are:
These operators are case insensitive and may be upper, lower, or mixed case, unless the {{opUp}} configuration setting is set to "true", which would then treat them (and all other operator keywords) as normal terms unless they are entirely upper case.

h4. Excluding Terms from Advanced Proximity Queries

Normally, any combination of terms may appear between the terms that mark the start and end of an advanced proximity query (the BEFORE, AFTER, and NEAR operators), but in some situations it is desirable to prevent specific terms from occurring between those start and end terms. Just as with a simple keyword query, this exclusion can be done by listing terms preceded by the minus sign '\-' or NOT operator. The NOT operator, if used, must be enclosed in parentheses '( )'.

For example, these pairs of queries are equivalent:

{{George NEAR Washington -person}}
{{George NEAR Washington (NOT person)}}

{{George NEAR Lincoln -person}}
{{George NEAR Lincoln (NOT person)}}

Also, the exclusions may be specified on either side of the proximity operator, so the following queries are equivalent:

{{George NEAR Lincoln -person}}
{{George -person NEAR Lincoln}}
{{George NEAR Lincoln (NOT person)}}
{{George (NOT person) NEAR Lincoln}}

{anchor:lucidparser.proximity.distance}

h45. Controlling Distance Between Terms

By default, the distance between the two terms of a proximity operator can be up to 15 additional terms. That default distance is controlled by the {{nearSlop}} configuration setting. But if you need more or fewer intervening terms for a specific proximity operator, you can specify the desired limit of intervening terms by writing a colon (":") and the number immediately after the operator name. For example,
{anchor:lucidparser.proximity.longsequences}

h35. Composing Longer Sequences of Terms

The advanced proximity operators can be composed (or "daisy-chained") to match more complex term sequences. For example:
{anchor:lucidparser.proximity.evalorder}

h35. Left to Right Evaluation Order

When multiple advanced proximity operators are composed, they are evaluated left to right, except as parentheses are used to explicitly specify the evaluation order. So, the previous example is evaluated as:
{anchor:lucidparser.proximity.quotedphrases}

h35. Quoted Phrases

Quoted phrases with any number of terms can be used as the operands of the proximity operators. For example,
{anchor:lucidparser.proximity.quotedproxphrases}

h35. Quoted Proximity Phrases

Quoted phrases may specify a maximum number of terms that may appear between the terms of the phrase, using the usual quoted phrase proximity query notation of a tilde ("~") and the number of terms permitted. For example,
{info}

{anchor:lucidparser.proximity.alternative}

h3. Alternative Terms

Alternatives can also be quoted phrases. For example, {{("In the beginning" or "At the start" or "Starting out") before:1000 "the end"}} will match documents containing the phrase "the end" preceded by either the phrase "In the beginning", "At the start", or "Starting out" with up to 1,000 intervening terms.

h3. Term Lists
{anchor:lucidparser.proximity.termlists}

h5. Term Lists

A phrase that is not enclosed within quotes is known as a _term list_ and may be used as either of the operands of a proximity operator, where it will be treated as if it were a quoted phrase. For example,

{anchor:lucidparser.proximity.parenthesized.termlists}

h45. Parenthesized Proximity Expressions in Term Lists

Although term lists with proximity operators may seem like a mere convenience to avoid typing the quotes around a phrase, the construct is much more powerful. Each of the terms in a proximity term list can be one of:
{anchor:lucidparser.proximity.singlefield}

h35. Single Field

Although field names can be used for terms within a proximity expression, only the first field name is used and the others are ignored since an entire proximity expression is evaluated within only a single field.