org.apache.lucene.search

Class Weight

    • Constructor Detail

      • Weight

        protected Weight(Query query)
        Sole constructor, typically invoked by sub-classes.
        Parameters:
        query - the parent query
    • Method Detail

      • extractTerms

        public abstract void extractTerms(Set<Term> terms)
        Expert: adds all terms occurring in this query to the terms set. If the Weight was created with needsScores == true then this method will only extract terms which are used for scoring, otherwise it will extract all terms which are used for matching.
      • getQuery

        public final Query getQuery()
        The query that this concerns.
      • normalize

        public abstract void normalize(float norm,
                                       float boost)
        Assigns the query normalization factor and boost to this.
      • bulkScorer

        public BulkScorer bulkScorer(LeafReaderContext context)
                              throws IOException
        Optional method, to return a BulkScorer to score the query and send hits to a Collector. Only queries that have a different top-level approach need to override this; the default implementation pulls a normal Scorer and iterates and collects the resulting hits which are not marked as deleted.
        Parameters:
        context - the LeafReaderContext for which to return the Scorer.
        Returns:
        a BulkScorer which scores documents and passes them to a collector.
        Throws:
        IOException - if there is a low-level I/O error