Solr
  1. Solr
  2. SOLR-1095

StopFilterFactory should not use HashSet

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: None
    • Labels:
      None

      Description

      Rev 680935 of StopFilterFactory introduced some changes that can cause poor performance do to the use of HashSet instead of CharArraySet in the inform() method. I noticed this while profiling http://www.lucidimagination.com/search/document/f46f0edfc439356c/solr_user_upgrade_from_1_2_to_1_3_gives_3x_slowdown whereby 20% of the time spent in indexing occurred in Collections.addAll() in the Lucene StopFilter due to the execution of the else clause in the lines:

      if (stopWords instanceof CharArraySet) {
            this.stopWords = (CharArraySet)stopWords;
          } else {
            this.stopWords = new CharArraySet(stopWords.size(), ignoreCase);
            this.stopWords.addAll(stopWords);
          }
      
      1. SOLR-1095.patch
        17 kB
        Grant Ingersoll

        Issue Links

          Activity

          Hide
          Grant Ingersoll added a comment -

          I should also note this is probably more noticeable in this particular case due to the fact that the data in question has a lot of small fields.

          Show
          Grant Ingersoll added a comment - I should also note this is probably more noticeable in this particular case due to the fact that the data in question has a lot of small fields.
          Hide
          Grant Ingersoll added a comment -

          SOLR-663 introduced the problem

          Show
          Grant Ingersoll added a comment - SOLR-663 introduced the problem
          Hide
          Yonik Seeley added a comment -

          Nice catch! Looks like KeepWordFilterFactory should also pass a CharArraySet, and then KeepWordFilter should check the set type, just like StopFilter does.

          Show
          Yonik Seeley added a comment - Nice catch! Looks like KeepWordFilterFactory should also pass a CharArraySet, and then KeepWordFilter should check the set type, just like StopFilter does.
          Hide
          Grant Ingersoll added a comment -

          Here's a patch to fix this issue.

          It:

          1. Adds tests
          2. Simplifies the inform code (fixing another issue related to the original code)
          3. Fixes the performance problem
          4. Fixes a small performance problem on the KeepFilter
          Show
          Grant Ingersoll added a comment - Here's a patch to fix this issue. It: Adds tests Simplifies the inform code (fixing another issue related to the original code) Fixes the performance problem Fixes a small performance problem on the KeepFilter
          Hide
          Grant Ingersoll added a comment -

          FYI: I intend to commit tomorrow or Thursday.

          Show
          Grant Ingersoll added a comment - FYI: I intend to commit tomorrow or Thursday.
          Hide
          Grant Ingersoll added a comment -

          Committed revision 761036.

          Show
          Grant Ingersoll added a comment - Committed revision 761036.
          Hide
          Grant Ingersoll added a comment -

          Bulk close Solr 1.4 issues

          Show
          Grant Ingersoll added a comment - Bulk close Solr 1.4 issues

            People

            • Assignee:
              Grant Ingersoll
              Reporter:
              Grant Ingersoll
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development