lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <j...@basetechnology.com>
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
To: solr-user@lucene.apache.org
Subject: Whole Phrase search in Solr

Hello,

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"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

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

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"
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: 
http://lucene.472066.n3.nabble.com/Whole-Phrase-search-in-Solr-tp4023931.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Mime
View raw message