Reputation: 264
I try to understand two methods of the title class i.e Field. Here is method which contains those two methods.
protected void addAnalyzedField(Document document, String fieldName, TokenStream tokenizer,
boolean withNorms, boolean withTermFreqAndPositions) {
Field field = new Field(fieldName, tokenizer);
field.setOmitNorms(!withNorms);
field.setOmitTermFreqAndPositions(!withTermFreqAndPositions);
document.add(field);
}
I was absolutely confused for field.setOmitNorms(boolean....)
and field.setOmitTermFreqAndPositions(boolean....)
that what these two methods really does? I was guessing that these method are used whether the field are omitted from/to indexing process. Am I right?
Can anybody can show up with some practical scenarios?
Thanks.
Upvotes: 0
Views: 197
Reputation: 26713
If you only want to store the field without indexing, simply use StoredField. If other fields on the same document will get indexed and point to this document during the search, you will be able to retrieve the same value as you presented.
Norms are explained here.
Term frequencies allow to tell how many matching terms have been found in the index.
Upvotes: 1