@Bindable public class SimpleFieldMapper extends Object implements IFieldMapper
IFieldMapper with one-to-one mapping between the default title, url
and summary fields.| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
SimpleFieldMapper() |
| Modifier and Type | Method and Description |
|---|---|
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. |
@Input @Attribute @Processing @Internal(configuration=true) @Label(value="Document title field") @Level(value=BASIC) @Group(value="Index field mapping") public String titleField
@Input @Attribute @Processing @Internal(configuration=true) @Label(value="Document content field") @Level(value=BASIC) @Group(value="Index field mapping") public String contentField
@Input @Attribute @Processing @Internal(configuration=true) @Label(value="Document URL field") @Level(value=BASIC) @Group(value="Index field mapping") public String urlField
@Input @Attribute @Processing @Internal(configuration=true) @Label(value="Search fields") @Level(value=MEDIUM) @Group(value="Index field mapping") public List<String> searchFields
@Input @Attribute @Processing @Label(value="Formatter") @Level(value=ADVANCED) @Group(value="Highlighter") public org.apache.lucene.search.highlight.Formatter formatter
null.@Input @Attribute @Processing @IntRange(min=1) @Label(value="Context fragments") @Level(value=ADVANCED) @Group(value="Highlighter") public int contextFragments
@Input @Attribute @Processing @Label(value="Join string") @Level(value=ADVANCED) @Group(value="Highlighter") public String fragmentJoin
public String[] getSearchFields()
IFieldMappergetSearchFields in interface IFieldMapperpublic void map(org.apache.lucene.search.Query luceneQuery,
org.apache.lucene.analysis.Analyzer analyzer,
org.apache.lucene.document.Document luceneDoc,
Document doc)
IFieldMapperDocument instance.
It is sensible to map at least Document.CONTENT_URL,
Document.TITLE and
Document.SUMMARY.map in interface IFieldMapperluceneQuery - 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.