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 Mohammad Shariq <sh...@gmail.com> on 2011/07/14 11:26:49 UTC

how to do ExactMatch for PhraseQuery

I need exact match On PhraseQuery.
when I search for the phrase "call it spring"   I get the result for :
1) It's spring
2) The spring

but my requirement is ExactMatch for PhraseQuery.
my search field is text.
Along with PhraseQuery I am doing RegularQuery too.
how to tune the solr to do Exactmatch for PhraseQuery without affecting
RegularQuery.

below is "text" field of schema.xml.

<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.CommonGramsFilterFactory" words="stopwords.txt"
maxShingleSize="3" ignoreCase="true"/>
    <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1"
generateNumberParts="1" catenateWords="1" catenateNumbers="1"
catenateAll="0" splitOnCaseChange="1"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.SnowballPorterFilterFactory" language="English"
protected="protwords.txt"/>

    </analyzer><analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.CommonGramsFilterFactory" words="stopwords.txt"
maxShingleSize="3" ignoreCase="true"/>
    <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1"
generateNumberParts="1" catenateWords="0" catenateNumbers="0"
catenateAll="0" splitOnCaseChange="1"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.SnowballPorterFilterFactory" language="English"
protected="protwords.txt"/>
    </analyzer>
</fieldType>



Thanks
Shariq

Re: how to do ExactMatch for PhraseQuery

Posted by "in.abdul" <in...@gmail.com>.
use* keywordfilter *that will helpfull for your requirement

            Thanks and Regards,
        S SYED ABDUL KATHER
                9731841519


On Thu, Jul 14, 2011 at 2:57 PM, Mohammad Shariq [via Lucene] <
ml-node+3168601-303697702-389623@n3.nabble.com> wrote:

> I need exact match On PhraseQuery.
> when I search for the phrase "call it spring"   I get the result for :
> 1) It's spring
> 2) The spring
>
> but my requirement is ExactMatch for PhraseQuery.
> my search field is text.
> Along with PhraseQuery I am doing RegularQuery too.
> how to tune the solr to do Exactmatch for PhraseQuery without affecting
> RegularQuery.
>
> below is "text" field of schema.xml.
>
> <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
>     <analyzer type="index">
>     <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>     <filter class="solr.CommonGramsFilterFactory" words="stopwords.txt"
> maxShingleSize="3" ignoreCase="true"/>
>     <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1"
> generateNumberParts="1" catenateWords="1" catenateNumbers="1"
> catenateAll="0" splitOnCaseChange="1"/>
>     <filter class="solr.LowerCaseFilterFactory"/>
>     <filter class="solr.SnowballPorterFilterFactory" language="English"
> protected="protwords.txt"/>
>
>     </analyzer><analyzer type="query">
>     <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>     <filter class="solr.CommonGramsFilterFactory" words="stopwords.txt"
> maxShingleSize="3" ignoreCase="true"/>
>     <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1"
> generateNumberParts="1" catenateWords="0" catenateNumbers="0"
> catenateAll="0" splitOnCaseChange="1"/>
>     <filter class="solr.LowerCaseFilterFactory"/>
>     <filter class="solr.SnowballPorterFilterFactory" language="English"
> protected="protwords.txt"/>
>     </analyzer>
> </fieldType>
>
>
>
> Thanks
> Shariq
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/how-to-do-ExactMatch-for-PhraseQuery-tp3168601p3168601.html
>  To unsubscribe from Lucene, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=472066&code=aW4uYWJkdWxAZ21haWwuY29tfDQ3MjA2NnwxMDczOTUyNDEw>.
>
>


-----
THANKS AND REGARDS,
SYED ABDUL KATHER
--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-do-ExactMatch-for-PhraseQuery-tp3168601p3168677.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to do ExactMatch for PhraseQuery

Posted by Ahmet Arslan <io...@yahoo.com>.
Not sure but, don't you need to use CommonGramsQueryFilterFactory at query time?

http://lucene.apache.org/solr/api/org/apache/solr/analysis/CommonGramsQueryFilter.html

--- On Thu, 7/14/11, Mohammad Shariq <sh...@gmail.com> wrote:

> From: Mohammad Shariq <sh...@gmail.com>
> Subject: how to do ExactMatch for PhraseQuery
> To: solr-user@lucene.apache.org
> Date: Thursday, July 14, 2011, 12:26 PM
> I need exact match On PhraseQuery.
> when I search for the phrase "call it
> spring"   I get the result for :
> 1) It's spring
> 2) The spring
> 
> but my requirement is ExactMatch for PhraseQuery.
> my search field is text.
> Along with PhraseQuery I am doing RegularQuery too.
> how to tune the solr to do Exactmatch for PhraseQuery
> without affecting
> RegularQuery.
> 
> below is "text" field of schema.xml.
> 
> <fieldType name="text" class="solr.TextField"
> positionIncrementGap="100">
>     <analyzer type="index">
>     <tokenizer
> class="solr.WhitespaceTokenizerFactory"/>
>     <filter
> class="solr.CommonGramsFilterFactory" words="stopwords.txt"
> maxShingleSize="3" ignoreCase="true"/>
>     <filter
> class="solr.WordDelimiterFilterFactory"
> generateWordParts="1"
> generateNumberParts="1" catenateWords="1"
> catenateNumbers="1"
> catenateAll="0" splitOnCaseChange="1"/>
>     <filter
> class="solr.LowerCaseFilterFactory"/>
>     <filter
> class="solr.SnowballPorterFilterFactory" language="English"
> protected="protwords.txt"/>
> 
>     </analyzer><analyzer
> type="query">
>     <tokenizer
> class="solr.WhitespaceTokenizerFactory"/>
>     <filter
> class="solr.CommonGramsFilterFactory" words="stopwords.txt"
> maxShingleSize="3" ignoreCase="true"/>
>     <filter
> class="solr.WordDelimiterFilterFactory"
> generateWordParts="1"
> generateNumberParts="1" catenateWords="0"
> catenateNumbers="0"
> catenateAll="0" splitOnCaseChange="1"/>
>     <filter
> class="solr.LowerCaseFilterFactory"/>
>     <filter
> class="solr.SnowballPorterFilterFactory" language="English"
> protected="protwords.txt"/>
>     </analyzer>
> </fieldType>
> 
> 
> 
> Thanks
> Shariq
>