org.egothor.core.query
Class ResultList

java.lang.Object
  extended by org.egothor.util.BiQueue<Hit>
      extended by org.egothor.core.query.ResultList

public final class ResultList
extends BiQueue<Hit>

A ResultList is a collection of Hits. The Hits at first are stored just as document IDs gotten from a Barrel. Calling resolve(org.egothor.core.Barrel) allows the retrieval of metadata of a document.

This two step process speeds up the querying, because when preparing the ResultList, there is no need to load complete metadata of documents. When the final ResultList is ready, the metadata is loaded from the Barrels.

Author:
Leo Galambos
See Also:
Hit.resolve()

Constructor Summary
ResultList(int size, long max_accepted, double pagerank_rerank)
          Constructor for the ResultList object.
 
Method Summary
 boolean add(Hit item)
          Add the given Hit if there is a free cell for it or it is greater than the lowest element of this array.
 void addGuessedHits(long hits)
           
 void addHitsScanned(long hits)
           
 void dump()
           
 long getHitsScanned()
          Return the total number of elements which were read during a query evaluation.
 long getWouldBe()
          Return the total number of elements that tried to get to this structure via the add method.
 boolean isNotCramfull()
           
 boolean lessThan(Hit a, Hit b)
          Test whether a is less than b .
 int linearize()
          Transform this structure to a linear structure.
 void resolve(Barrel what)
          Retrieve document metadata for the Hits in this ResultList.
 
Methods inherited from class org.egothor.util.BiQueue
append, capacity, clear, cutOffLast, down, down, expand, item, itemto, peek, pop, push, replace, size, up
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultList

public ResultList(int size,
                  long max_accepted,
                  double pagerank_rerank)
Constructor for the ResultList object. All hits can be boosted by logV(uid), where uid is hit uid and V is a rerank value.

Parameters:
size - the desired size of this object
max_accepted - maximum number of hits this object accepts
pagerank_rerank - the rerank value, the rerank feature is not used iff the value is not above 1.0
Method Detail

dump

public void dump()

isNotCramfull

public boolean isNotCramfull()

addGuessedHits

public void addGuessedHits(long hits)

addHitsScanned

public void addHitsScanned(long hits)

getWouldBe

public long getWouldBe()
Return the total number of elements that tried to get to this structure via the add method.

Returns:
the total number of elements

getHitsScanned

public long getHitsScanned()
Return the total number of elements which were read during a query evaluation.

Returns:
the total number of hits scanned

lessThan

public boolean lessThan(Hit a,
                        Hit b)
Test whether a is less than b .

Specified by:
lessThan in class BiQueue<Hit>
Parameters:
a - the first object
b - the object to compare to a
Returns:
true if a<b, false otherwise

resolve

public void resolve(Barrel what)
Retrieve document metadata for the Hits in this ResultList. The given Barrel will be checked against each Hit's Barrel to be sure that the correct document metadata is retrieved.

Parameters:
what - the Barrel

linearize

public int linearize()
Description copied from class: BiQueue
Transform this structure to a linear structure.

Overrides:
linearize in class BiQueue<Hit>

add

public boolean add(Hit item)
Add the given Hit if there is a free cell for it or it is greater than the lowest element of this array. In the latter case the current lowest element is removed and the given Hit will be accepted. This method will return without executing if a null value is supplied.

Parameters:
item - the Hit to add, if possible
Returns:
whether we ever want more hits to be added
See Also:
isNotCramfull()