Lucene - Core
  1. Lucene - Core
  2. LUCENE-3331

consider allowing ScorerContext to specify that you dont need freqs/scores

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0-ALPHA
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      This is just an idea for discussion (I have not yet thought everything through: know of a non-scary way to do the patch yet).

      But I think that it would be useful for ScorerContext to specify something like 'docsOnly', e.g. ConstantScoreQuery could pass this down here:

      disi = innerWeight.scorer(context, scorerContext);
      

      Basically this flag would specify that the caller does not care about freq() and score(), and in this case e.g. TermScorer could use a
      docs-only bulkpostings for example, and never pull freqs.

      Additionally, it wouldn't need to create a Similarity.DocScorer, which is just wastefully computing score cache in this case,
      it could instead pass null, creat a scorer that does not use one, or use a Constant impl that always returns 1 or throws UOE,
      depending on how we want to specify that score()/freq() should act if the caller does actually call it when this flag is set.

        Activity

        Hide
        Uwe Schindler added a comment -

        Sounds like a good idea! QueryWrapperFilter can do the same.

        Show
        Uwe Schindler added a comment - Sounds like a good idea! QueryWrapperFilter can do the same.
        Hide
        Robert Muir added a comment -

        Also i think its a good idea if we do this to cleanup some of the things are scorers do.

        Currently we have some scorers that defer things until you call score(), in case you dont call it, but
        this causes things like the scorer-navigation/freq api to behave strangely.

        So doing this now would give us a way fix these bugs, e.g. if scores/freqs are not requested, and
        BQ has a mandatory clause it can just drop the optionals completely (return a simpler scorer)

        Show
        Robert Muir added a comment - Also i think its a good idea if we do this to cleanup some of the things are scorers do. Currently we have some scorers that defer things until you call score(), in case you dont call it, but this causes things like the scorer-navigation/freq api to behave strangely. So doing this now would give us a way fix these bugs, e.g. if scores/freqs are not requested, and BQ has a mandatory clause it can just drop the optionals completely (return a simpler scorer)
        Hide
        Michael McCandless added a comment -

        +1

        Show
        Michael McCandless added a comment - +1

          People

          • Assignee:
            Unassigned
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development