lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: Whole Phrase search in Solr
Date Mon, 03 Dec 2012 16:15:41 GMT
The OR behavior is because the default operator is OR. You can change that 
by setting q.op=AND.

Try the quoted phrases again, but with &debugQuery=true to see what query is 
actually generated.

Finally, if you remove stop words at index time, then you must remove them 
at query time as well.

-- Jack Krupansky

-----Original Message----- 
From: NickA
Sent: Monday, December 03, 2012 6:28 AM
Subject: Whole Phrase search in Solr


I am trying to achieve searching with a phrase in SOLR. Specifically I have
the following field in my schema:

   <field name="search_field" type="phrase_search" indexed="true"
stored="false" multiValued="true"/>

    <fieldType name=" phrase_search" class="solr.TextField"
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
        <filter class="solr.LowerCaseFilterFactory"/>
      <analyzer type="query">
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>

Also (as a second similar problem) in the “synonyms.txt” I have values like

aword => a whole phrase

and I even tried:

aword => "a whole phrase"

now I tried searching for “check this” in several ways:

fq=search_field:check this
fq=search_field:"check this"
fq=search_field:'check this'

but in all cases the search seems to run for “check OR this”!

similarly, if I search for “aword” which matches the synonyms file, the
search also looks for “a OR whole OR phrase”.

What am I doing wrong? Is there any way to force the query for the whole
phrase and not for each word separately?

View this message in context:
Sent from the Solr - User mailing list archive at 

View raw message