You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "John Wang (JIRA)" <ji...@apache.org> on 2010/03/26 22:36:27 UTC

[jira] Created: (SOLR-1850) KeepWordFilter can be slow at query time if wordlist is large

KeepWordFilter can be slow at query time if wordlist is large
-------------------------------------------------------------

                 Key: SOLR-1850
                 URL: https://issues.apache.org/jira/browse/SOLR-1850
             Project: Solr
          Issue Type: Improvement
          Components: Schema and Analysis
    Affects Versions: 1.4
            Reporter: John Wang


In the case when "Set<String> words" is large, constructing a KeepWordFilter at query time is very costly because of the construction (copy) of the set, e.g.:

    this.words = new CharArraySet(words, ignoreCase);

This call does an addAll on the set, and is done for each query, and is the same work.

Suggestion: overload the constructor and expose the CharArraySet, e.g.:

  public KeepWordFilter(TokenStream in, CharArraySet words ) {
    super(in);
    this.words = words;
    this.termAtt = (TermAttribute)addAttribute(TermAttribute.class);
  }

This allows the ability to have CharArraySet to be constructed once staticly for the application instead at query time.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1850) KeepWordFilter can be slow at query time if wordlist is large

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850392#action_12850392 ] 

Yonik Seeley commented on SOLR-1850:
------------------------------------

Yes, that's definitely the way to go.

> KeepWordFilter can be slow at query time if wordlist is large
> -------------------------------------------------------------
>
>                 Key: SOLR-1850
>                 URL: https://issues.apache.org/jira/browse/SOLR-1850
>             Project: Solr
>          Issue Type: Improvement
>          Components: Schema and Analysis
>    Affects Versions: 1.4
>            Reporter: John Wang
>
> In the case when "Set<String> words" is large, constructing a KeepWordFilter at query time is very costly because of the construction (copy) of the set, e.g.:
>     this.words = new CharArraySet(words, ignoreCase);
> This call does an addAll on the set, and is done for each query, and is the same work.
> Suggestion: overload the constructor and expose the CharArraySet, e.g.:
>   public KeepWordFilter(TokenStream in, CharArraySet words ) {
>     super(in);
>     this.words = words;
>     this.termAtt = (TermAttribute)addAttribute(TermAttribute.class);
>   }
> This allows the ability to have CharArraySet to be constructed once staticly for the application instead at query time.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1850) KeepWordFilter can be slow at query time if wordlist is large

Posted by "John Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850377#action_12850377 ] 

John Wang commented on SOLR-1850:
---------------------------------

Hi Yonk:

     No problem! Do you think overloading the constructor is the right thing to do here?

-John

> KeepWordFilter can be slow at query time if wordlist is large
> -------------------------------------------------------------
>
>                 Key: SOLR-1850
>                 URL: https://issues.apache.org/jira/browse/SOLR-1850
>             Project: Solr
>          Issue Type: Improvement
>          Components: Schema and Analysis
>    Affects Versions: 1.4
>            Reporter: John Wang
>
> In the case when "Set<String> words" is large, constructing a KeepWordFilter at query time is very costly because of the construction (copy) of the set, e.g.:
>     this.words = new CharArraySet(words, ignoreCase);
> This call does an addAll on the set, and is done for each query, and is the same work.
> Suggestion: overload the constructor and expose the CharArraySet, e.g.:
>   public KeepWordFilter(TokenStream in, CharArraySet words ) {
>     super(in);
>     this.words = words;
>     this.termAtt = (TermAttribute)addAttribute(TermAttribute.class);
>   }
> This allows the ability to have CharArraySet to be constructed once staticly for the application instead at query time.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1850) KeepWordFilter can be slow at query time if wordlist is large

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850367#action_12850367 ] 

Yonik Seeley commented on SOLR-1850:
------------------------------------

Thanks for catching this John, copying the whole set each time is bad enough, I'd be tempted to classify it as a bug.

> KeepWordFilter can be slow at query time if wordlist is large
> -------------------------------------------------------------
>
>                 Key: SOLR-1850
>                 URL: https://issues.apache.org/jira/browse/SOLR-1850
>             Project: Solr
>          Issue Type: Improvement
>          Components: Schema and Analysis
>    Affects Versions: 1.4
>            Reporter: John Wang
>
> In the case when "Set<String> words" is large, constructing a KeepWordFilter at query time is very costly because of the construction (copy) of the set, e.g.:
>     this.words = new CharArraySet(words, ignoreCase);
> This call does an addAll on the set, and is done for each query, and is the same work.
> Suggestion: overload the constructor and expose the CharArraySet, e.g.:
>   public KeepWordFilter(TokenStream in, CharArraySet words ) {
>     super(in);
>     this.words = words;
>     this.termAtt = (TermAttribute)addAttribute(TermAttribute.class);
>   }
> This allows the ability to have CharArraySet to be constructed once staticly for the application instead at query time.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-1850) KeepWordFilter can be slow at query time if wordlist is large

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley resolved SOLR-1850.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1

Thanks John, I've committed this suggestion along with a testcase fix.

> KeepWordFilter can be slow at query time if wordlist is large
> -------------------------------------------------------------
>
>                 Key: SOLR-1850
>                 URL: https://issues.apache.org/jira/browse/SOLR-1850
>             Project: Solr
>          Issue Type: Improvement
>          Components: Schema and Analysis
>    Affects Versions: 1.4
>            Reporter: John Wang
>             Fix For: 3.1
>
>
> In the case when "Set<String> words" is large, constructing a KeepWordFilter at query time is very costly because of the construction (copy) of the set, e.g.:
>     this.words = new CharArraySet(words, ignoreCase);
> This call does an addAll on the set, and is done for each query, and is the same work.
> Suggestion: overload the constructor and expose the CharArraySet, e.g.:
>   public KeepWordFilter(TokenStream in, CharArraySet words ) {
>     super(in);
>     this.words = words;
>     this.termAtt = (TermAttribute)addAttribute(TermAttribute.class);
>   }
> This allows the ability to have CharArraySet to be constructed once staticly for the application instead at query time.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.