You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by ku3ia <de...@gmail.com> on 2014/04/24 22:14:33 UTC

StopFilter:enablePositionIncrements question

Hi all! My question is not new in maillist, but I can't found a solution. I'm
using Solr 4.6.0. My text field definition is

<fieldType name="text" class="solr.TextField"
autoGeneratePhraseQueries="true">
  <analyzer>
    <tokenizer class="solr.ClassicTokenizerFactory"/>
    <filter class="solr.ClassicFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.KStemFilterFactory"/>
    <filter class="solr.TrimFilterFactory"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt"
ignoreCase="true" />
    <filter class="solr.LengthFilterFactory" min="2" max="50" />
  </analyzer>
</fieldType>

In SolrConfig – <luceneMatchVersion>LUCENE_46</luceneMatchVersion>

Via core/Documents I'm adding a document, ex, {"id":"1","title":"Need for
speed"}. Keyword "for" is in my stopwords.txt file, so in index will be two
terms: "need" and "speed".

Due to https://issues.apache.org/jira/browse/LUCENE-4963
enablePositionIncrements feature was deprecated, but simply changed by
default from "false" to "true" in StopWords filter.

My stopwords file contains keywords: and, or, for, then, such, etc.

When I'm searching phrase
"need for speed" it is ok, Solr returns my doc;
"need speed" – no match;
"need such speed" – returns a doc.

Does it normal, that when I change "for" to any keyword from stopwords list
– Solr returns a document, but when I omit "for" keyword in phrase – Solr
returns nothing?

Early, I used Solr 4.3 and I haven't any problems with this.

And a last question: how I need to change my config or schema files, to get
matches when searching phrase like "need speed"?

Thanks.




--
View this message in context: http://lucene.472066.n3.nabble.com/StopFilter-enablePositionIncrements-question-tp4132979.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: StopFilter:enablePositionIncrements question

Posted by ku3ia <de...@gmail.com>.
Hi, Ahmet! Thanks for your reply. I understand, that it is ok. And one more
question, based on
https://issues.apache.org/jira/browse/LUCENE-4963
>>We have some TokenFilters which are only broken with specific options.
This includes:
>>StopFilter, ..., LengthFilter when enablePositionIncrements=false

can you give an example, when these token filters will be broken with
enablePositionIncrements=false. 
Thanks.



--
View this message in context: http://lucene.472066.n3.nabble.com/StopFilter-enablePositionIncrements-question-tp4132979p4133095.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: StopFilter:enablePositionIncrements question

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi,

All of your examples are OK and normal/expected.

Regarding "need speed", please see Uwe's post for a similar question : http://search-lucene.com/m/WwzTb2PybMJ1

Ahmet



On Thursday, April 24, 2014 11:15 PM, ku3ia <de...@gmail.com> wrote:
Hi all! My question is not new in maillist, but I can't found a solution. I'm
using Solr 4.6.0. My text field definition is

<fieldType name="text" class="solr.TextField"
autoGeneratePhraseQueries="true">
  <analyzer>
    <tokenizer class="solr.ClassicTokenizerFactory"/>
    <filter class="solr.ClassicFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.KStemFilterFactory"/>
    <filter class="solr.TrimFilterFactory"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt"
ignoreCase="true" />
    <filter class="solr.LengthFilterFactory" min="2" max="50" />
  </analyzer>
</fieldType>

In SolrConfig – <luceneMatchVersion>LUCENE_46</luceneMatchVersion>

Via core/Documents I'm adding a document, ex, {"id":"1","title":"Need for
speed"}. Keyword "for" is in my stopwords.txt file, so in index will be two
terms: "need" and "speed".

Due to https://issues.apache.org/jira/browse/LUCENE-4963
enablePositionIncrements feature was deprecated, but simply changed by
default from "false" to "true" in StopWords filter.

My stopwords file contains keywords: and, or, for, then, such, etc.

When I'm searching phrase
"need for speed" it is ok, Solr returns my doc;
"need speed" – no match;
"need such speed" – returns a doc.

Does it normal, that when I change "for" to any keyword from stopwords list
– Solr returns a document, but when I omit "for" keyword in phrase – Solr
returns nothing?

Early, I used Solr 4.3 and I haven't any problems with this.

And a last question: how I need to change my config or schema files, to get
matches when searching phrase like "need speed"?

Thanks.




--
View this message in context: http://lucene.472066.n3.nabble.com/StopFilter-enablePositionIncrements-question-tp4132979.html
Sent from the Solr - User mailing list archive at Nabble.com.