Lucene - Core
  1. Lucene - Core
  2. LUCENE-2674

improve how MTQs interact with the terms dict cache

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Some small improvements:

      • Adds a TermsEnum.cacheCurrentTerm "hint" (codec can make this a no-op)
      • Removes the FTE.useTermsCache
      • Changes MTQ's TermCollector API to accept the TermsEnum so collectors can eg call .docFreq directly
      • Adds expert ctor to TermQuery allowing you to pass in the docFreq
      1. LUCENE-2674.patch
        31 kB
        Michael McCandless
      2. LUCENE-2674.patch
        28 kB
        Michael McCandless
      3. LUCENE-2674.patch
        28 kB
        Michael McCandless
      4. LUCENE-2674.patch
        16 kB
        Michael McCandless

        Activity

        Hide
        Michael McCandless added a comment -

        Maybe we should consider the small patch to Standard's terms dict cache in LUCENE-2672?

        +1

        I'll fold it in...

        Show
        Michael McCandless added a comment - Maybe we should consider the small patch to Standard's terms dict cache in LUCENE-2672 ? +1 I'll fold it in...
        Hide
        Robert Muir added a comment -

        Patch looks good to me.

        Enabling the caching for seeking in the TermsEnum itself wasnt very good, because some queries (e.g. Fuzzy) seek to more terms than they will end out "using" in the BooleanQuery. Its much better to be in the rewrite method. And I like passing docfreq so we the queries are less fragile and depend on this cache less.

        Maybe we should consider the small patch to Standard's terms dict cache in LUCENE-2672? The issue is that clone() with this hierarchy can be expensive, its new in flex because of the TermState abstraction i think. This might be important in rewrite methods that are going to add a lot of these terms (it certainly showed up in my profiler and made a big difference)

        Uwe found an excellent explanation of this: http://forums.java.net/jive/thread.jspa?messageID=16538&tstart=0
        It even affects arrays too, there is a bug for the array case, but its only fixed in -server: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6195753

        Show
        Robert Muir added a comment - Patch looks good to me. Enabling the caching for seeking in the TermsEnum itself wasnt very good, because some queries (e.g. Fuzzy) seek to more terms than they will end out "using" in the BooleanQuery. Its much better to be in the rewrite method. And I like passing docfreq so we the queries are less fragile and depend on this cache less. Maybe we should consider the small patch to Standard's terms dict cache in LUCENE-2672 ? The issue is that clone() with this hierarchy can be expensive, its new in flex because of the TermState abstraction i think. This might be important in rewrite methods that are going to add a lot of these terms (it certainly showed up in my profiler and made a big difference) Uwe found an excellent explanation of this: http://forums.java.net/jive/thread.jspa?messageID=16538&tstart=0 It even affects arrays too, there is a bug for the array case, but its only fixed in -server: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6195753
        Hide
        Michael McCandless added a comment -

        Another iter.

        This time I added a cache in SimpleText codec, to map field -> Terms instance. With this patch, running all tests w/ SimpleText is only 50% slower than Standard, so I put SimpleText back into the random rotation.

        Show
        Michael McCandless added a comment - Another iter. This time I added a cache in SimpleText codec, to map field -> Terms instance. With this patch, running all tests w/ SimpleText is only 50% slower than Standard, so I put SimpleText back into the random rotation.
        Hide
        Michael McCandless added a comment -

        Fixed TQ to actually use the docFreq passed to it...

        Show
        Michael McCandless added a comment - Fixed TQ to actually use the docFreq passed to it...
        Hide
        Michael McCandless added a comment -

        Another rev, fixes the 2 nocommits plus a few other issues.

        I think it's ready to commit!

        Show
        Michael McCandless added a comment - Another rev, fixes the 2 nocommits plus a few other issues. I think it's ready to commit!
        Hide
        Michael McCandless added a comment -

        Initial patch... still a couple nocommits...

        Show
        Michael McCandless added a comment - Initial patch... still a couple nocommits...

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Michael McCandless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development