Class LuceneIndexExpressions

java.lang.Object
com.apple.foundationdb.record.lucene.LuceneIndexExpressions

public class LuceneIndexExpressions extends Object
The root expression of a LUCENE index specifies how select fields of a record are mapped to fields of a Lucene document.

The expression tree is made up of the following.
Structure

  • concat includes multiple subexpressions in the index. Since these are flattened, order does not really matter.
  • nest traverses a nested subrecord. By default, the name of the parent field is prepended to the names of descendent fields.

Fields

  • field is a record field whose value is added to the index. By default, a field is indexed as a scalar value. That is, even a string with whitespace is a single token.
  • function(lucene_text) annotates a document field as text so that it is tokenized in the Lucene index.
  • function(lucene_stored) annotates a document field as additionally stored in the document so that its value is returned in searches.

Names
By default, the name of each field in the hierarchy of nested subrecords is included in the name of flattened fields. function(lucene_field_name) overrides this.

  • value(null) skips adding any name prefix, introducing the possibility of flattened name collisions.
  • field(key) allows another field to give the name. This is useful for map-like nested subrecords with well-known keys.

The expression tree can be walked in several different ways, either with an actual record to produce actual fields, or with record meta-data to determine what possible fields there are. Specifically,

  • map a record into a document
  • get a list of document field names
  • validate the index expression at definition time
  • compute correlated matching expressions for the query planner