lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qi Li <aler...@gmail.com>
Subject How to calculate the fieldNorm
Date Tue, 21 Sep 2010 20:19:42 GMT
Hi, guys:

I read this  http://lucene.apache.org/java/3_0_2/api/core/index.html . But I
am confused about how the fieldNorm is calculated after seeing the
explanation.

( I am using StandardAnalyzer for both index and search)
*1.. Index Part*
     document 0:
           doc.add(new Field("test","it's time to pay income tax",
Field.Store.YES, Field.Index.Analyzed));
           doc.add(new Field("test","return library books on time",
Field.Store.YES, Field.Index.Analyzed));

     document 1:
          doc.add(new Field("test","it's time to pay income tax return
library books on time", Field.Store.YES, Field.Index.Analyzed));

*2.  Search Part*
        QueryParser parser = new QueryParser(Version.LUCENE_30,
"test",standard);
        Query query = parser.parse("tax return");
       TopDocs hits = searcher.search(query, 10);

*3.  Result with explanation*

*document id: 0*
score : 26.905577
26.905577 = (MATCH) sum of:
  13.452788 = (MATCH) weight(major:tax in 0), product of:
    0.70710677 = queryWeight(major:tax), product of:
      0.5945349 = idf(docFreq=2, maxDocs=2)
      1.1893445 = queryNorm
    19.025116 = (MATCH) fieldWeight(major:tax in 0), product of:
      1.0 = tf(termFreq(major:tax)=1)
      0.5945349 = idf(docFreq=2, maxDocs=2)
*      32.0 = fieldNorm(field=major, doc=0)*
  13.452788 = (MATCH) weight(major:return in 0), product of:
    0.70710677 = queryWeight(major:return), product of:
      0.5945349 = idf(docFreq=2, maxDocs=2)
      1.1893445 = queryNorm
    19.025116 = (MATCH) fieldWeight(major:return in 0), product of:
      1.0 = tf(termFreq(major:return)=1)
      0.5945349 = idf(docFreq=2, maxDocs=2)
   *   32.0 = fieldNorm(field=major, doc=0)*

*document id: 1*
score : 0.31529972
0.31529972 = (MATCH) sum of:
  0.15764986 = (MATCH) weight(major:tax in 1), product of:
    0.70710677 = queryWeight(major:tax), product of:
      0.5945349 = idf(docFreq=2, maxDocs=2)
      1.1893445 = queryNorm
    0.22295058 = (MATCH) fieldWeight(major:tax in 1), product of:
      1.0 = tf(termFreq(major:tax)=1)
      0.5945349 = idf(docFreq=2, maxDocs=2)
      *0.375 = fieldNorm(field=major, doc=1)*
  0.15764986 = (MATCH) weight(major:return in 1), product of:
    0.70710677 = queryWeight(major:return), product of:
      0.5945349 = idf(docFreq=2, maxDocs=2)
      1.1893445 = queryNorm
    0.22295058 = (MATCH) fieldWeight(major:return in 1), product of:
      1.0 = tf(termFreq(major:return)=1)
      0.5945349 = idf(docFreq=2, maxDocs=2)
      *0.375 = fieldNorm(field=major, doc=1)*


*4. Questions:*
   1.  why the the value of fieldNorm is so different ?  (32.0   vs 0.375)
.
   2.  Anybody knows how to calculate the fieldNorm for this case by hand?

Thank you very much.

Best regards,
Qi Li

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message