Lucene - Core
  1. Lucene - Core
  2. LUCENE-6379

IndexWriter's delete-by-query should optimize/specialize MatchAllDocsQuery

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      We can short-circuit this to just IW.deleteAll (Solr already does so I think). This also has the nice side effect of clearing Lucene's low-schema (FieldInfos).

      1. LUCENE-6379.patch
        5 kB
        Michael McCandless
      2. LUCENE-6379.patch
        5 kB
        Michael McCandless

        Activity

        Hide
        Michael McCandless added a comment -

        Patch w/ simple test showing that Lucene's schema is actually reset (omitNorms goes away for a field).

        Show
        Michael McCandless added a comment - Patch w/ simple test showing that Lucene's schema is actually reset (omitNorms goes away for a field).
        Hide
        Adrien Grand added a comment -

        +1

        Show
        Adrien Grand added a comment - +1
        Hide
        Robert Muir added a comment -

        +1

        Show
        Robert Muir added a comment - +1
        Hide
        Adrien Grand added a comment -

        One minor paranoid nitpick: I just noticed MatchAllDocsQuery is not final and the code checks instanceof. So maybe we should make MatchAllDocsQuery final or check that query.getClass() == MatchAllDocsQuery.class (or both).

        Show
        Adrien Grand added a comment - One minor paranoid nitpick: I just noticed MatchAllDocsQuery is not final and the code checks instanceof. So maybe we should make MatchAllDocsQuery final or check that query.getClass() == MatchAllDocsQuery.class (or both).
        Hide
        Michael McCandless added a comment -

        So maybe we should make MatchAllDocsQuery final or check that query.getClass() == MatchAllDocsQuery.class (or both).

        Nice catch! I did both, in this new patch ...

        Show
        Michael McCandless added a comment - So maybe we should make MatchAllDocsQuery final or check that query.getClass() == MatchAllDocsQuery.class (or both). Nice catch! I did both, in this new patch ...
        Hide
        Adrien Grand added a comment -

        +1!

        Show
        Adrien Grand added a comment - +1!
        Hide
        ASF subversion and git services added a comment -

        Commit 1670410 from Michael McCandless in branch 'dev/trunk'
        [ https://svn.apache.org/r1670410 ]

        LUCENE-6379: short circuit IndexWriter.deleteDocuments(MatchAllDocsQuery) to the much faster and schema-cleansing .deleteAll

        Show
        ASF subversion and git services added a comment - Commit 1670410 from Michael McCandless in branch 'dev/trunk' [ https://svn.apache.org/r1670410 ] LUCENE-6379 : short circuit IndexWriter.deleteDocuments(MatchAllDocsQuery) to the much faster and schema-cleansing .deleteAll
        Hide
        ASF subversion and git services added a comment -

        Commit 1670412 from Michael McCandless in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1670412 ]

        LUCENE-6379: short circuit IndexWriter.deleteDocuments(MatchAllDocsQuery) to the much faster and schema-cleansing .deleteAll

        Show
        ASF subversion and git services added a comment - Commit 1670412 from Michael McCandless in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1670412 ] LUCENE-6379 : short circuit IndexWriter.deleteDocuments(MatchAllDocsQuery) to the much faster and schema-cleansing .deleteAll
        Hide
        Timothy Potter added a comment -

        Bulk close after 5.1 release

        Show
        Timothy Potter added a comment - Bulk close after 5.1 release

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development