lux.index
Class IndexConfiguration

java.lang.Object
  extended by lux.index.IndexConfiguration

public class IndexConfiguration
extends Object

Maintains a list of field definitions and index options that inform indexing and search. The configuration options and core indexing setup are immutable, but new fields may be added, fields may be renamed, and namespace mappings may be defined.


Field Summary
static FieldDefinition ATT_QNAME
          attribute QName field
static FieldDefinition ATTRIBUTE_TEXT
          attribute text field indexes all the text along with attribute QNames.
static int BUILD_DOCUMENT
          causes a document node to be built during indexing.
static int COMPUTE_OFFSETS
          enables the computation and storage of term offsets in the index.
static IndexConfiguration DEFAULT
          The default configuration instance
static int DEFAULT_OPTIONS
          the default indexing options
static FieldDefinition ELEMENT_TEXT
          element text field indexes all the text along with element QNames.
static FieldDefinition ELT_QNAME
          element QName field
static int INDEX_EACH_PATH
          experimental: index each occurrence of each path as an unparsed string, rather than indexing unique paths and tokenizing
static int INDEX_FULLTEXT
          enables the XML_TEXT, ELEMENT_TEXT, and ATTRIBUTE_TEXT fields, causing element and attribute text to be indexed.
static int INDEX_PATHS
          enables the PATH field, causing element and attribute QName paths to be indexed.
static int INDEX_QNAMES
          enables the ELT_QNAME and ATT_QNAME fields, causing element and attribute QNames to be indexed.
static int INDEX_VALUES
          enables the PATH_VALUE field (if INDEX_PATHS is set), and the QNAME_VALUE field (if INDEX_QNAMES is set), causing values to be indexed.
static int INDEXES
          mask covering all of the indexing options
static org.apache.lucene.util.Version LUCENE_VERSION
           
static int NAMESPACE_AWARE
          causes QNames indexes to include the full namespace uri.
static FieldDefinition PATH
          path field
static FieldDefinition PATH_VALUE
           
static FieldDefinition QNAME_VALUE
           
static int SOLR
          Configure for use in solr; eg TinyBinarySolrField instead of TinyBinaryField
static int STORE_DOCUMENT
          causes a document to be stored in the index.
static int STORE_TINY_BINARY
          indicates that documents are to be stored in TinyBinary format.
static int STRIP_NAMESPACES
          causes all namespace information to be stripped from incoming documents
static FieldDefinition URI
          unique identifier field that identifies a document
static FieldDefinition XML_TEXT
          full text field that indexes all the text in a document (not including attribute values).
 
Constructor Summary
protected IndexConfiguration()
           
protected IndexConfiguration(long options)
           
 
Method Summary
 void addField(FieldDefinition field)
          adds a new field
 void defineNamespaceMapping(String prefix, String namespaceURI)
           
 String getDefaultFieldName()
           
 FieldDefinition getField(FieldName fieldName)
           
 FieldDefinition getField(String fieldName)
           
 MultiFieldAnalyzer getFieldAnalyzers()
           
 String getFieldName(FieldDefinition field)
          Get the effective name of a field, given its definition.
 String getFieldName(FieldName field)
          Get the effective name of a field, given its canonical name.
 Collection<FieldDefinition> getFields()
           
 Map<String,String> getNamespaceMap()
           
 boolean isIndexingEnabled()
           
 boolean isOption(int option)
           
static IndexConfiguration makeIndexConfiguration(long options)
           
 void renameField(FieldDefinition field, String name)
          rename an existing field; the new name is used in the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LUCENE_VERSION

public static final org.apache.lucene.util.Version LUCENE_VERSION

BUILD_DOCUMENT

public static final int BUILD_DOCUMENT
causes a document node to be built during indexing. Must be set if any XPathFields are to be defined.

See Also:
Constant Field Values

SOLR

public static final int SOLR
Configure for use in solr; eg TinyBinarySolrField instead of TinyBinaryField

See Also:
Constant Field Values

NAMESPACE_AWARE

public static final int NAMESPACE_AWARE
causes QNames indexes to include the full namespace uri. If not set, QNames are indexed lexically, as {prefix}:{localname} without regard for any prefix mappings. Currently namespace-unaware indexing and search is not fully supported.

See Also:
Constant Field Values

STORE_DOCUMENT

public static final int STORE_DOCUMENT
causes a document to be stored in the index. This should generally always be enabled

See Also:
Constant Field Values

STORE_TINY_BINARY

public static final int STORE_TINY_BINARY
indicates that documents are to be stored in TinyBinary format. If this is not set, documents are stored as serialized XML.

See Also:
Constant Field Values

INDEX_QNAMES

public static final int INDEX_QNAMES
enables the ELT_QNAME and ATT_QNAME fields, causing element and attribute QNames to be indexed. If paths are indexed, this isn't really needed.

See Also:
Constant Field Values

INDEX_PATHS

public static final int INDEX_PATHS
enables the PATH field, causing element and attribute QName paths to be indexed.

See Also:
Constant Field Values

INDEX_FULLTEXT

public static final int INDEX_FULLTEXT
enables the XML_TEXT, ELEMENT_TEXT, and ATTRIBUTE_TEXT fields, causing element and attribute text to be indexed.

See Also:
Constant Field Values

INDEX_VALUES

public static final int INDEX_VALUES
enables the PATH_VALUE field (if INDEX_PATHS is set), and the QNAME_VALUE field (if INDEX_QNAMES is set), causing values to be indexed. This is an experimental feature that is not fully supported.

See Also:
Constant Field Values

COMPUTE_OFFSETS

public static final int COMPUTE_OFFSETS
enables the computation and storage of term offsets in the index. Currently there is no reason to enable this flag. In the future term offsets may be used to accelerate highlighting.

See Also:
Constant Field Values

STRIP_NAMESPACES

public static final int STRIP_NAMESPACES
causes all namespace information to be stripped from incoming documents

See Also:
Constant Field Values

INDEX_EACH_PATH

public static final int INDEX_EACH_PATH
experimental: index each occurrence of each path as an unparsed string, rather than indexing unique paths and tokenizing

See Also:
Constant Field Values

INDEXES

public static final int INDEXES
mask covering all of the indexing options

See Also:
Constant Field Values

DEFAULT_OPTIONS

public static final int DEFAULT_OPTIONS
the default indexing options

See Also:
Constant Field Values

URI

public static final FieldDefinition URI
unique identifier field that identifies a document


ELT_QNAME

public static final FieldDefinition ELT_QNAME
element QName field


ATT_QNAME

public static final FieldDefinition ATT_QNAME
attribute QName field


PATH

public static final FieldDefinition PATH
path field


ELEMENT_TEXT

public static final FieldDefinition ELEMENT_TEXT
element text field indexes all the text along with element QNames.


ATTRIBUTE_TEXT

public static final FieldDefinition ATTRIBUTE_TEXT
attribute text field indexes all the text along with attribute QNames.


XML_TEXT

public static final FieldDefinition XML_TEXT
full text field that indexes all the text in a document (not including attribute values).


PATH_VALUE

public static final FieldDefinition PATH_VALUE

QNAME_VALUE

public static final FieldDefinition QNAME_VALUE

DEFAULT

public static final IndexConfiguration DEFAULT
The default configuration instance

Constructor Detail

IndexConfiguration

protected IndexConfiguration(long options)

IndexConfiguration

protected IndexConfiguration()
Method Detail

getFieldAnalyzers

public MultiFieldAnalyzer getFieldAnalyzers()
Returns:
the analyzers associated with the fields to be indexed

makeIndexConfiguration

public static IndexConfiguration makeIndexConfiguration(long options)
Parameters:
options -
Returns:
a new IndexCOnfiguration with the given options, unless the options are the default options, in which case DEFAULT is returned.

addField

public void addField(FieldDefinition field)
adds a new field

Parameters:
field - the field to add

getFieldName

public String getFieldName(FieldName field)
Get the effective name of a field, given its canonical name. Fields may be renamed, or aliased, for compatibility with existing schemas.

Parameters:
field - a field's canonical name
Returns:
the effective name of the field

getFieldName

public String getFieldName(FieldDefinition field)
Get the effective name of a field, given its definition. Fields may be renamed, or aliased, for compatibility with existing schemas.

Parameters:
field - a field definition
Returns:
the effective name of the field

renameField

public void renameField(FieldDefinition field,
                        String name)
rename an existing field; the new name is used in the index.

Parameters:
field - the definition of a field
name - the new name to use

getFields

public Collection<FieldDefinition> getFields()

getField

public FieldDefinition getField(FieldName fieldName)

getField

public FieldDefinition getField(String fieldName)

getDefaultFieldName

public String getDefaultFieldName()

isOption

public boolean isOption(int option)
Parameters:
option - an option bit constant
Returns:
whether the option is set

isIndexingEnabled

public boolean isIndexingEnabled()

getNamespaceMap

public Map<String,String> getNamespaceMap()

defineNamespaceMapping

public void defineNamespaceMapping(String prefix,
                                   String namespaceURI)


Copyright © 2013. All Rights Reserved.