it.unimi.dsi.mg4j.search
Class IntervalIterators

java.lang.Object
  extended byit.unimi.dsi.mg4j.search.IntervalIterators

public class IntervalIterators
extends Object

A class providing static methods and objects that do useful things with interval iterators.


Nested Class Summary
static class IntervalIterators.EmptyIntervalIterator
          An iterator returning no intervals.
static class IntervalIterators.FakeIterator
          An iterator that throws an exception on all method calls, except for IntervalIterators.FakeIterator.hasNext(), which has a settable value.
 
Field Summary
static IntervalIterators.EmptyIntervalIterator EMPTY_ITERATOR
           
static IntervalIterator FALSE
          An iterator representing absolute falseness.
static IntervalIterator TRUE
          An iterator representing absolute truth.
 
Method Summary
static double clarkeCormackScore(IntervalIterator it)
          Computes the Clarke-Cormack score using the default values for parameter (h=16 and alpha=1).
static double clarkeCormackScore(IntervalIterator it, double alpha, int h)
          Computes the Clarke-Cormack score of a document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ITERATOR

public static final IntervalIterators.EmptyIntervalIterator EMPTY_ITERATOR

TRUE

public static final IntervalIterator TRUE
An iterator representing absolute truth.

When this iterator is returned by a subquery on a given index, this means that the index has no part in the construction of the result, but that, at the same time, the result is true.

For example, consider the query (foo OR title:bar) AND fee evaluated on a document which contains bar in the title index, but not foo in the primary index, and which moreover contains fee in the primary index. The subquery (foo OR title:bar) has value TRUE on the primary index, as there is nothing to be returned, but the subquery is nonetheless true.


FALSE

public static final IntervalIterator FALSE
An iterator representing absolute falseness.

When this iterator is returned by a subquery on a given index, this means that the subquery is false.

For example, consider the query (foo AND title:bar) OR fee evaluated on a document which contains bar in the title index, but not foo in the primary index, and which moreover contains fee in the primary index. The subquery (foo AND title:bar) has value FALSE on both the primary and the title index.

Method Detail

clarkeCormackScore

public static final double clarkeCormackScore(IntervalIterator it,
                                              double alpha,
                                              int h)
Computes the Clarke-Cormack score of a document.

Parameters:
it - the iterator; note that the iterator gets exhausted by this call.
alpha - the parameter used in the computation of the score.
h - the parameter used in the computation of the score.
Returns:
the score.
See Also:
ClarkeCormackScorer

clarkeCormackScore

public static final double clarkeCormackScore(IntervalIterator it)
Computes the Clarke-Cormack score using the default values for parameter (h=16 and alpha=1).

Parameters:
it - the iterator; note that the iterator gets exhausted by this call.
Returns:
the score.