Revision: 14602
          http://gate.svn.sourceforge.net/gate/?rev=14602&view=rev
Author:   valyt
Date:     2011-11-24 14:01:39 +0000 (Thu, 24 Nov 2011)
Log Message:
-----------
Also make the scores available (to support e.g. Federated Query runners).

Modified Paths:
--------------
    mimir/trunk/mimir-core/src/gate/mimir/search/QueryRunner.java
    mimir/trunk/mimir-core/src/gate/mimir/search/RankingQueryRunnerImpl.java

Modified: mimir/trunk/mimir-core/src/gate/mimir/search/QueryRunner.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/search/QueryRunner.java       
2011-11-24 10:35:25 UTC (rev 14601)
+++ mimir/trunk/mimir-core/src/gate/mimir/search/QueryRunner.java       
2011-11-24 14:01:39 UTC (rev 14602)
@@ -74,6 +74,17 @@
           IOException;
 
   /**
+   * Get the score for a given result document. The value for the score 
depends 
+   * on the scorer used by the {@link QueryEngine} (see 
+   * {@link QueryEngine#setScorerSource(java.util.concurrent.Callable)}). 
+   * @param rank the index of the desired document in the list of documents. 
+   * This should be a value between 0 and {@link #getDocumentsCount()} -1.
+   * @return
+   */
+  public double getDocumentScore(int rank)  throws IndexOutOfBoundsException, 
+      IOException ;
+  
+  /**
    * Retrieves the hits within a given result document.
    * @param rank the index of the desired document in the list of documents.
    * This should be a value between 0 and {@link #getDocumentsCount()} -1.

Modified: 
mimir/trunk/mimir-core/src/gate/mimir/search/RankingQueryRunnerImpl.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/search/RankingQueryRunnerImpl.java    
2011-11-24 10:35:25 UTC (rev 14601)
+++ mimir/trunk/mimir-core/src/gate/mimir/search/RankingQueryRunnerImpl.java    
2011-11-24 14:01:39 UTC (rev 14602)
@@ -382,6 +382,11 @@
     return documentIds.getInt(getDocumentIndex(rank));
   }
   
+  @Override
+  public double getDocumentScore(int rank) throws IndexOutOfBoundsException, 
IOException {
+    return documentScores.getDouble(getDocumentIndex(rank));
+  }
+
   /* (non-Javadoc)
    * @see gate.mimir.search.QueryRunner#getDocumentHits(int)
    */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to