Tao wrote:
> Hi Paolo,
>
> Just noticed some change in the LARQ score. Originally the score seemed to
> be normalized to range [0, 1]. Now the score can be higher than 1. Is this a
> change of Lucene or LARQ?
>
> How can I get the old good [0, 1] LARQ score now?
>
> Thanks
> Tao

Hi Tao,
first of all, thanks.

I see... LARQ is now using Lucene 3.x and something might have changed there or
something went wrong while porting LARQ over Lucene 3.x new APIs.

Do you want to raise a JIRA issue for this?
https://issues.apache.org/jira/browse/JENA

The good news is that it should not be that difficult to fix and if you want you
can try submitting a patch for this.

All searches call the IndexLARQ.search(...) [1] method which does something like
this (reformatted):

  TopDocs topDocs = ...
  Map1<ScoreDoc,HitLARQ> converter = new Map1<ScoreDoc,HitLARQ>(){
    public HitLARQ map1(ScoreDoc object) {
      return new HitLARQ(searcher, object) ;
    }} ;
  Iterator<ScoreDoc> iterScoreDoc =
    Arrays.asList(topDocs.scoreDocs).iterator() ;
  Iterator<HitLARQ> iter =
    new Map1Iterator<ScoreDoc, HitLARQ>(converter, iterScoreDoc) ;
  return iter ;

There is a getMaxScore method in Lucene's TopDocs [2] which we can use to
normalize scores for the same query.

Paolo

 [1]
http://svn.apache.org/repos/asf/incubator/jena/Jena2/LARQ/trunk/src/main/java/org/apache/jena/larq/IndexLARQ.java
 [2]
http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/api/core/org/apache/lucene/search/TopDocs.html#getMaxScore%28%29

Reply via email to