org.gcube.search.datafusion.datatypes
Class RankedRecord

java.lang.Object
  extended by org.gcube.search.datafusion.datatypes.RankedRecord
All Implemented Interfaces:
Serializable, Comparable<RankedRecord>

public class RankedRecord
extends Object
implements Comparable<RankedRecord>, Serializable

Author:
Alex Antoniadis
See Also:
Serialized Form

Constructor Summary
RankedRecord(String id, Long position, Float rank, Integer luceneDocID)
           
RankedRecord(String id, Long position, Float rank, Integer luceneDocID, Boolean includePosition)
           
 
Method Summary
static Float calcScore(RankedRecord r)
          Calculates the score of the record.
 int compareTo(RankedRecord r)
           
 boolean equals(Object obj)
           
 Integer getLuceneDocID()
           
 int hashCode()
           
static List<RankedRecord> recalculateScores(Map<String,Long> recPositions, Map<String,Pair> recScores, Boolean includePosition)
          Recalculates the score of the records that are retrieved after querying the lucene index in order to perform some other refinements.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RankedRecord

public RankedRecord(String id,
                    Long position,
                    Float rank,
                    Integer luceneDocID,
                    Boolean includePosition)

RankedRecord

public RankedRecord(String id,
                    Long position,
                    Float rank,
                    Integer luceneDocID)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getLuceneDocID

public Integer getLuceneDocID()

compareTo

public int compareTo(RankedRecord r)
Specified by:
compareTo in interface Comparable<RankedRecord>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

calcScore

public static Float calcScore(RankedRecord r)
Calculates the score of the record. If includePosition is true then the total score is the sum of the rank and the score that is calculated in RankedRecord#posScore, else rank is returned.

Parameters:
r -
Returns:
score of record

recalculateScores

public static List<RankedRecord> recalculateScores(Map<String,Long> recPositions,
                                                   Map<String,Pair> recScores,
                                                   Boolean includePosition)
Recalculates the score of the records that are retrieved after querying the lucene index in order to perform some other refinements. Currently, if includePosition is true the score of the results is recalculated from their initial position.

Parameters:
recPositions -
recScores -
includePosition -
Returns:
resorted list of RankedRecords


Copyright © 2013. All Rights Reserved.