org.hibernate.search.engine.impl
Class LuceneOptionsImpl

java.lang.Object
  extended by org.hibernate.search.engine.impl.LuceneOptionsImpl
All Implemented Interfaces:
LuceneOptions

public class LuceneOptionsImpl
extends Object
implements LuceneOptions

A wrapper class for Lucene parameters needed for indexing.

Author:
Hardy Ferentschik, Sanne Grinovero, Gustavo Fernandes

Constructor Summary
LuceneOptionsImpl(Store store, org.apache.lucene.document.Field.Index indexMode, org.apache.lucene.document.Field.TermVector termVector, float boost)
           
LuceneOptionsImpl(Store store, org.apache.lucene.document.Field.Index indexMode, org.apache.lucene.document.Field.TermVector termVector, float boost, String indexNullAs, int precisionStep)
           
 
Method Summary
 void addFieldToDocument(String name, String indexedString, org.apache.lucene.document.Document document)
          Add a new field with the name fieldName to the Lucene Document document using the value indexedString.
 void addNumericFieldToDocument(String fieldName, Object value, org.apache.lucene.document.Document document)
          Add a new NumericField with the name fieldName to the Lucene Document document using the value numericValue.
 float getBoost()
          Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document.
 org.apache.lucene.document.Field.Index getIndex()
          Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document.
 org.apache.lucene.document.Field.Store getStore()
          Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document.
 Store getStoreStrategy()
          Might be useful for a bridge implementation, but not currently part of LuceneOptions API as we are considering to remove the getters.
 org.apache.lucene.document.Field.TermVector getTermVector()
          Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document.
 String indexNullAs()
           
 boolean isCompressed()
          Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneOptionsImpl

public LuceneOptionsImpl(Store store,
                         org.apache.lucene.document.Field.Index indexMode,
                         org.apache.lucene.document.Field.TermVector termVector,
                         float boost)

LuceneOptionsImpl

public LuceneOptionsImpl(Store store,
                         org.apache.lucene.document.Field.Index indexMode,
                         org.apache.lucene.document.Field.TermVector termVector,
                         float boost,
                         String indexNullAs,
                         int precisionStep)
Method Detail

addFieldToDocument

public void addFieldToDocument(String name,
                               String indexedString,
                               org.apache.lucene.document.Document document)
Description copied from interface: LuceneOptions
Add a new field with the name fieldName to the Lucene Document document using the value indexedString. If the indexedString is null then the field is not added to the document. The field options are following the user declaration:

Specified by:
addFieldToDocument in interface LuceneOptions
Parameters:
name - The field name
indexedString - The value to index
document - the document to which to add the the new field

addNumericFieldToDocument

public void addNumericFieldToDocument(String fieldName,
                                      Object value,
                                      org.apache.lucene.document.Document document)
Description copied from interface: LuceneOptions
Add a new NumericField with the name fieldName to the Lucene Document document using the value numericValue. If the value is not numeric then the field is not added to the document

Specified by:
addNumericFieldToDocument in interface LuceneOptions
Parameters:
fieldName - The name of the field
value - The numeric value, either an Int, Long, Float or Double
document - the document to which to add the the new field

getBoost

public float getBoost()
Description copied from interface: LuceneOptions
Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document.

Specified by:
getBoost in interface LuceneOptions
Returns:
Returns the boost factor declared by the user

indexNullAs

public String indexNullAs()
Specified by:
indexNullAs in interface LuceneOptions
Returns:
Returns the string for indexing null values. null is returned in case no null token has been specified.

isCompressed

public boolean isCompressed()
Description copied from interface: LuceneOptions
Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document. To use compression either use #addFieldToDocument or refer to Lucene documentation to implement your own compression strategy.

Specified by:
isCompressed in interface LuceneOptions
Returns:
the compression strategy declared by the user true if the field value is compressed, false otherwise.

getIndex

public org.apache.lucene.document.Field.Index getIndex()
Description copied from interface: LuceneOptions
Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document.

Specified by:
getIndex in interface LuceneOptions
Returns:
Returns the indexing strategy declared by the user

getStore

public org.apache.lucene.document.Field.Store getStore()
Description copied from interface: LuceneOptions
Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document. org.apache.lucene.document.Field.Store.YES if the field is stored org.apache.lucene.document.Field.Store.NO otherwise. To determine if the field must be compressed, use LuceneOptions.isCompressed(). Starting from version 3.3, Store.COMPRESS is no longer returned, use LuceneOptions.isCompressed() To use compression either use #addFieldToDocument or refer to Lucene documentation to implement your own compression strategy.

Specified by:
getStore in interface LuceneOptions
Returns:
Returns the store strategy declared by the user

getTermVector

public org.apache.lucene.document.Field.TermVector getTermVector()
Description copied from interface: LuceneOptions
Prefer the use of LuceneOptions.addFieldToDocument(String, String, org.apache.lucene.document.Document) over manually building your Field objects and adding them to the Document.

Specified by:
getTermVector in interface LuceneOptions
Returns:
Returns the term vector strategy declared by the user

getStoreStrategy

public Store getStoreStrategy()
Might be useful for a bridge implementation, but not currently part of LuceneOptions API as we are considering to remove the getters.



Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved