The LIFTI Query Language

When you have constructed a FullTextIndexer instance and set its QueryParser property to a LiftiQueryParser, you will be able to search the full text index using the LIFTI query language. This will allow you to write queries using the following operators:

Query Meaning
West West must appear in the text.
doc* Words that starts with doc must appear in the text.
west & wing The words west and wing must appear in the text
west wing The words west and wing must appear in the text - the default operator is & if none is specified between search words
west | wing The words west or wing must appear in the text
west ~ wing west and wing must appear near to each other (within 5 words) in the text
west ~> wing west must be closely followed by wing (within 5 words) in the text
west >> wing west must precede wing anywhere in the text
"the west wing" The words the west wing must appear in sequence in the indexed text.
"notr* dam*" A word starting with notr must be immediately followed by a word starting with dam.

If you specify two search words in a query without a joining operator, then they will automatically be combined with an and (&) operator, so the queries west & wing is equivalent to west wing. (Just to clarify, searching for "west wing" is different - this indicates that the words should appear in sequence - the previous searches only enforce that the words appear somewhere in the text.)

Longer queries

Query operators can be combined, so you can write a query such as the & west & wing to search for items that have all 3 words indexed against them.
Naturally you can mix and match operators, so "west wing" & "oval office" would search for items with the phrases "west wing" and "oval office" indexed against them.
When combining operators you need to be aware of operator precedence. Operators will be processed in the following order:
  1. Positional operators (~, ~> and >>)
  2. And (&)
  3. Or (|)

This means that west & wing | oval office would search for items containing both west and wing, or items containing oval and office.

You can specify your own precedence by using brackets
This means that you could write west & (wing | oval) & office to search for items containing west and office and either wing or oval.

Last edited Jun 9, 2011 at 4:58 PM by MikeGoatly, version 2

Comments

No comments yet.