Interface Scorer

    • Method Summary

      Modifier and Type Method Description
      Scorer copy()  
      Reference2DoubleMap<Index> getWeights()
      Gets the weight map for this scorer (if applicable).
      long nextDocument()
      Returns the next document provided by this scorer, or -1 if no more documents are available.
      double score()
      Returns a score for the current document of the last document iterator given to wrap(DocumentIterator).
      double score​(Index index)
      Returns a score for the current document of the last document iterator given to wrap(DocumentIterator), but considering only a given index (optional operation).
      boolean setWeights​(Reference2DoubleMap<Index> index2Weight)
      Sets the weight map for this scorer (if applicable).
      boolean usesIntervals()
      Whether this scorer uses intervals.
      void wrap​(DocumentIterator documentIterator)
      Wraps a document iterator and prepares the internal state of this scorer to work with it.
    • Method Detail

      • score

        double score​(Index index)
              throws IOException
        Returns a score for the current document of the last document iterator given to wrap(DocumentIterator), but considering only a given index (optional operation).
        Parameters:
        index - the only index to be considered.
        Returns:
        the score.
        Throws:
        IOException
      • setWeights

        boolean setWeights​(Reference2DoubleMap<Index> index2Weight)
        Sets the weight map for this scorer (if applicable).

        The given map will be copied internally and can be used by the caller without affecting the scorer behaviour. Implementing classes should rescale the weights so that they have sum equal to one.

        Indices not appearing in the map will have weight equal to 0.

        Parameters:
        index2Weight - a map from indices to weights.
        Returns:
        true if this scorer supports weights.
      • getWeights

        Reference2DoubleMap<Index> getWeights()
        Gets the weight map for this scorer (if applicable).

        Returns a copy of the weight map of this scorer.

        Returns:
        a copy of the weight map of this scorer.
      • wrap

        void wrap​(DocumentIterator documentIterator)
           throws IOException
        Wraps a document iterator and prepares the internal state of this scorer to work with it.

        Subsequent calls to score() and score(Index) will use d to compute the score.

        Parameters:
        documentIterator - the document iterator that will be used in subsequent calls to score() and score(Index).
        Throws:
        IOException
      • usesIntervals

        boolean usesIntervals()
        Whether this scorer uses intervals.

        This method is essential when aggregating scorers, because if several scores need intervals, a CachingDocumentIterator will be necessary.

        Returns:
        true if this scorer uses intervals.
      • nextDocument

        long nextDocument()
                   throws IOException
        Returns the next document provided by this scorer, or -1 if no more documents are available.
        Returns:
        the next document, or -1 if no more documents are available.
        Throws:
        IOException