https://www.elastic.co/guide/en/elasticsearch/reference/6.5/norms.html
https://www.cnblogs.com/o-andy-o/p/3877562.html
Field text_entryField = new TextField("text_entry", text_entry, Field.Store.YES);
doc.add(text_entryField);
FieldType TYPE_STORED = new FieldType();
TYPE_STORED.setOmitNorms(true);
TYPE_STORED.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
TYPE_STORED.setTokenized(true);
TYPE_STORED.setStored(true);
TYPE_STORED.freeze();
Field my_text_entryField = new Field("text_entry_2", text_entry, TYPE_STORED);
doc.add(my_text_entryField);
Query query = null;
TopDocs topDocs = null;
query = new TermQuery(new Term("text_entry", "who"));
topDocs = indexSearcher.search(query, 10);
if (topDocs.totalHits > 0) {
Document document = null;
for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
document = indexReader.document(scoreDoc.doc);
System.out.println(document.get("text_entry"));
System.out.println(indexSearcher.explain(query, scoreDoc.doc));
}
}
query = new TermQuery(new Term("text_entry_2", "who"));
topDocs = indexSearcher.search(query, 10);
if (topDocs.totalHits > 0) {
Document document = null;
for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
document = indexReader.document(scoreDoc.doc);
System.out.println(document.get("text_entry_2"));
System.out.println(indexSearcher.explain(query, scoreDoc.doc));
}
}
Norms: True
Who then, affrighted with their bloody looks,
4.597653 = weight(text_entry:who in 433) [BM25Similarity], result of:
4.597653 = score(doc=433,freq=1.0 = termFreq=1.0
), product of:
4.1053944 = idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:
16.0 = docFreq
1000.0 = docCount
1.1199054 = tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.75 = parameter b
5.418 = avgFieldLength
4.0 = fieldLength
Who then, affrighted with their bloody looks,
4.597653 = weight(text_entry:who in 433) [BM25Similarity], result of:
4.597653 = score(doc=433,freq=1.0 = termFreq=1.0
), product of:
4.1053944 = idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:
16.0 = docFreq
1000.0 = docCount
1.1199054 = tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.75 = parameter b
5.418 = avgFieldLength
4.0 = fieldLength
Norms: False
A son who is the theme of honours tongue;
4.1053944 = weight(text_entry_2:who in 83) [BM25Similarity], result of:
4.1053944 = score(doc=83,freq=1.0 = termFreq=1.0
), product of:
4.1053944 = idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:
16.0 = docFreq
1000.0 = docCount
1.0 = tfNorm, computed as (freq * (k1 + 1)) / (freq + k1) from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.0 = parameter b (norms omitted for field)
Who is sweet Fortunes minion and her pride:
4.1053944 = weight(text_entry_2:who in 85) [BM25Similarity], result of:
4.1053944 = score(doc=85,freq=1.0 = termFreq=1.0
), product of:
4.1053944 = idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:
16.0 = docFreq
1000.0 = docCount
1.0 = tfNorm, computed as (freq * (k1 + 1)) / (freq + k1) from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.0 = parameter b (norms omitted for field)