Two things can be done. 1 or 2.

1-) You can use tokenizerFactory attribute of synonym filter factory.

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


2-) You can use escape white spaces in synonyms.txt

fund\ manager\ summary, fund\ manager\ report



--- On Fri, 11/26/10, Jason Brown <jason.br...@sjp.co.uk> wrote:

> From: Jason Brown <jason.br...@sjp.co.uk>
> Subject: Synonym Filtering on String Fields
> To: solr-user@lucene.apache.org
> Date: Friday, November 26, 2010, 12:15 PM
> 
> I have the following field type set up in my schema. The
> idea is to fire phrases of text such as 'fund manager
> summary' (without the quotes) at it, and for the synonym
> processing to recognise this, and add the rest of the
> synonyms (index-time synonym processing with expansion) to
> the index from my synonym file (example below)
> 
>  <fieldType name="synonymstring" class="solr.TextField"
> positionIncrementGap="100">
>       <analyzer type="index">
>         <tokenizer
> class="solr.KeywordTokenizerFactory"/>
>         <filter
> class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
>      </analyzer>
>       <analyzer type="query">
>         <tokenizer
> class="solr.KeywordTokenizerFactory"/>
>       </analyzer>
>     </fieldType>  
> 
> 
> in synonyms.txt.....
> 
> fund manager summary, fund manager report
> guide, product guide
> 
> I run into 2 issues...
> 
> (1) After analysis of the field in SOLR, I find that both 
> 
> fund manager summay
> fund manage report
> 
> are NOT getting picked up by the synonym factory (after
> processing I just get the source term outputted from the
> synonym filter)
> 
> (2) If I analyse guide, I do get product and guide (*2)
> outputted from the synonym filter factory - but as 
> seperate terms (3 terms in total), I expected it to generate
> just 1 additional term - i.e. product guide
> 
> It seems that it is able to pick up a single word and
> output two (as seperate terms), but it fails to pick up
> multiple words.
> 
> Can anyone help? (incidentally when I use this approach on
> a SOLR text field type it all works fine, but I cant use a
> SOLR text field type for this as I use this field for
> facetting.
> 
> 
> 
> If you wish to view the St. James's Place email disclaimer,
> please use the link below
> 
> http://www.sjp.co.uk/portal/internet/SJPemaildisclaimer
> 



Reply via email to