[ES-6.5.4] Mapping-Norms

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)

 

 

转载于:https://my.oschina.net/u/204498/blog/3062767

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值