Class LuceneItemAdapter

java.lang.Object
org.imixs.workflow.engine.lucene.LuceneItemAdapter

@Named public class LuceneItemAdapter extends Object
The LuceneItemAdapter is a CDI bean, providing methods to convert the value of an Imixs Item into a IndexableField. This kind of lucene fields can be stored in a Lucene Document.

You can overwrite the bean to provide an alternative method of value conversion.

Version:
1.1
Author:
rsoika
See Also:
  • LuceneUdpateService#addItemValues
  • Constructor Details

    • LuceneItemAdapter

      public LuceneItemAdapter()
  • Method Details

    • adaptItemValue

      public org.apache.lucene.index.IndexableField adaptItemValue(String itemName, Object itemValue, boolean doAnalyze)
      Creates a Indexable Lucene Field to be added into a Lucene document. The content of the itemValue will be converted. Depending on the parameter doAnalye a TextField or a StringField is created. The later is used for exact match.

      The item value will not be stored into the lucene document

      Parameters:
      itemName - - name of the item will be used as the doc field name
      itemValue - - the item value which will be converted by the method convertItemValue
      doAnalyze - - if true the content will by analyzed by the LuceneAnalyzer configured in the IndexWriter
      Returns:
    • adaptItemValue

      public org.apache.lucene.index.IndexableField adaptItemValue(String itemName, Object itemValue, boolean doAnalyze, org.apache.lucene.document.Field.Store stored)
      Creates a Indexable Lucene Field to be added into a Lucene document. The content of the itemValue will be converted. Depending on the parameter doAnalye a TextField or a StringField is created. The later is used for exact match.

      The parameter 'store' indicates if Lucene should store the item value in the document

      Store.NO - Store.YES

      Parameters:
      itemName - - name of the item will be used as the doc field name
      itemValue - - the item value which will be converted by the method convertItemValue
      doAnalyze - - if true the content will by analyzed by the LuceneAnalyzer configured in the IndexWriter
      Returns:
    • adaptSortableItemValue

      public org.apache.lucene.document.SortedDocValuesField adaptSortableItemValue(String itemName, Object itemValue)
      This method converts an ItemValue into a SortedDocValuesField.
      Parameters:
      itemName - - name of the item will be used as the doc field name
      itemValue - - the item value which will be converted by the method convertItemValue
      Returns:
      SortedDocValuesField
    • convertItemValue

      public String convertItemValue(Object itemValue)
      This method converts a ItemValue into a indexable text format. This method currently converts only Calendar and Date objects into a Luncene string representation of a date time value
      Parameters:
      itemValue - - object to be converted into a string
      Returns:
      string value