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 Jonty Rhods <jo...@gmail.com> on 2010/10/12 18:40:26 UTC

synonym configuration logic require

Hi all,

I am pretty new in solr. I want to configure synonym for forwarding result
(for exact match).

my schema is :

<fieldType name="text_sync" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
  <analyzer type="query">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>

          <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>

      </analyzer>
    </fieldType>


There is name field which is define as text_sync. When I am searching by
"newyork show" its working fine and giving exact result (there is exact
value "newyork show" in index).
Now I want if someone search by "newyork live show" I want to forward it to
"newyork show", so it will match exactly.
I put "newyork live show=>newyork show" in synonym but it is not working.
When changing tokenizer (query time) to standardtokenizerFilterFactory it
work but same time my normal result "newyork show" stop giving exact result.

My requirement is to highlight the background in html when exact match come.
so I want to use synonym..

please help me to get desire result or let me know if any other better way
to get my requirement...

Re: synonym configuration logic require

Posted by Jonathan Rochkind <ro...@jhu.edu>.
I am not sure there's any way to get query-time multi-word synonyms to 
work right,  because of the way the standard and dismax query parsers 
'pre-tokenize' (I don't know what the solr developers call this 
phenomenon? I call it "pre-tokenizing").   If you use the field query 
parser instead, it would work, but I don't think you want to do that.

Perhaps there's a way to do the kind of synonym you want only at index 
time and not at query time?  The latter part of this section of the wiki 
on the synonym filter may be helpful, it mentions your problem as point 1.

http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory



Jonty Rhods wrote:
> Hi all,
>
> I am pretty new in solr. I want to configure synonym for forwarding result
> (for exact match).
>
> my schema is :
>
> <fieldType name="text_sync" class="solr.TextField"
> positionIncrementGap="100">
>       <analyzer type="index">
>         <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
>       </analyzer>
>   <analyzer type="query">
>         <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
>
>           <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
>
>       </analyzer>
>     </fieldType>
>
>
> There is name field which is define as text_sync. When I am searching by
> "newyork show" its working fine and giving exact result (there is exact
> value "newyork show" in index).
> Now I want if someone search by "newyork live show" I want to forward it to
> "newyork show", so it will match exactly.
> I put "newyork live show=>newyork show" in synonym but it is not working.
> When changing tokenizer (query time) to standardtokenizerFilterFactory it
> work but same time my normal result "newyork show" stop giving exact result.
>
> My requirement is to highlight the background in html when exact match come.
> so I want to use synonym..
>
> please help me to get desire result or let me know if any other better way
> to get my requirement...
>
>