org.carrot2.source.lucene
Class SimpleFieldMapper

java.lang.Object
  extended by org.carrot2.source.lucene.SimpleFieldMapper
All Implemented Interfaces:
IFieldMapper

public class SimpleFieldMapper
extends Object
implements IFieldMapper

A simple IFieldMapper with one-to-one mapping between the default title, url and summary fields.


Field Summary
 String contentField
          Document content field name.
 int contextFragments
          Number of context fragments for the highlighter.
 org.apache.lucene.search.highlight.Formatter formatter
          Snippet formatter for the highlighter.
 String fragmentJoin
          A string used to join context fragments when highlighting.
 List<String> searchFields
          Index search field names.
 String titleField
          Document title field name.
 String urlField
          Document URL field name.
 
Constructor Summary
SimpleFieldMapper()
           
 
Method Summary
 String[] getSearchFields()
          Return the names of search fields in the index.
 void map(org.apache.lucene.search.Query luceneQuery, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.document.Document luceneDoc, Document doc)
          Map Lucene index's fields onto Carrot2 Document instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

titleField

public String titleField
Document title field name.

Attribute label:
Document title field
Attribute level:
Basic
Attribute group:
Index field mapping

contentField

public String contentField
Document content field name.

Attribute label:
Document content field
Attribute level:
Basic
Attribute group:
Index field mapping

urlField

public String urlField
Document URL field name.

Attribute label:
Document URL field
Attribute level:
Medium
Attribute group:
Index field mapping

searchFields

public List<String> searchFields
Index search field names. If not specified, title and content fields are used.

Attribute label:
Search fields
Attribute level:
Medium
Attribute group:
Index field mapping

formatter

public org.apache.lucene.search.highlight.Formatter formatter
Snippet formatter for the highlighter. Highlighter is not used if null .

Attribute label:
Formatter
Attribute level:
Advanced
Attribute group:
Highlighter

contextFragments

public int contextFragments
Number of context fragments for the highlighter.

Attribute label:
Context fragments
Attribute level:
Advanced
Attribute group:
Highlighter

fragmentJoin

public String fragmentJoin
A string used to join context fragments when highlighting.

Attribute label:
Join string
Attribute level:
Advanced
Attribute group:
Highlighter
Constructor Detail

SimpleFieldMapper

public SimpleFieldMapper()
Method Detail

getSearchFields

public String[] getSearchFields()
Description copied from interface: IFieldMapper
Return the names of search fields in the index.

Specified by:
getSearchFields in interface IFieldMapper

map

public void map(org.apache.lucene.search.Query luceneQuery,
                org.apache.lucene.analysis.Analyzer analyzer,
                org.apache.lucene.document.Document luceneDoc,
                Document doc)
Description copied from interface: IFieldMapper
Map Lucene index's fields onto Carrot2 Document instance. It is sensible to map at least Document.CONTENT_URL, Document.TITLE and Document.SUMMARY.

Specified by:
map in interface IFieldMapper
Parameters:
luceneQuery - Query used to fetch Lucene document from the index. It is advised to cache any query-related data internally and if this parameter does not change, reuse that data.
analyzer - Analyzer used for creating the index.
luceneDoc - Lucene hit.
doc - Target Carrot2 document.


Copyright (c) Dawid Weiss, Stanislaw Osinski