Module org.apache.lucene.suggest
Class CompletionFieldsConsumer
java.lang.Object
org.apache.lucene.codecs.FieldsConsumer
org.apache.lucene.search.suggest.document.CompletionFieldsConsumer
- All Implemented Interfaces:
Closeable
,AutoCloseable
Weighted FSTs for any indexed
SuggestField
is built on write(Fields,NormsProducer)
. A weighted FST maps the analyzed forms of a field to its surface
form and document id. FSTs are stored in the CompletionDictionary (.lkp).
The file offsets of a field's FST are stored in the CompletionIndex (.cmp) along with the
field's internal number FieldInfo.number
on close()
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final String
private FieldsConsumer
private final String
private IndexOutput
private final Map<String,
CompletionFieldsConsumer.CompletionMetaData> private final SegmentWriteState
-
Constructor Summary
ConstructorsConstructorDescriptionCompletionFieldsConsumer
(String codecName, PostingsFormat delegatePostingsFormat, SegmentWriteState state) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
write
(Fields fields, NormsProducer norms) Write all fields, terms and postings.Methods inherited from class org.apache.lucene.codecs.FieldsConsumer
merge
-
Field Details
-
delegatePostingsFormatName
-
seenFields
-
state
-
dictOut
-
delegateFieldsConsumer
-
codecName
-
closed
private boolean closed
-
-
Constructor Details
-
CompletionFieldsConsumer
CompletionFieldsConsumer(String codecName, PostingsFormat delegatePostingsFormat, SegmentWriteState state) throws IOException - Throws:
IOException
-
-
Method Details
-
write
Description copied from class:FieldsConsumer
Write all fields, terms and postings. This the "pull" API, allowing you to iterate more than once over the postings, somewhat analogous to using a DOM API to traverse an XML tree.Notes:
- You must compute index statistics, including each Term's docFreq and totalTermFreq, as well as the summary sumTotalTermFreq, sumTotalDocFreq and docCount.
- You must skip terms that have no docs and fields that have no terms, even though the provided Fields API will expose them; this typically requires lazily writing the field or term until you've actually seen the first term or document.
- The provided Fields instance is limited: you cannot call any methods that return statistics/counts; you cannot pass a non-null live docs when pulling docs/positions enums.
- Specified by:
write
in classFieldsConsumer
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classFieldsConsumer
- Throws:
IOException
-