[ 
https://issues.apache.org/jira/browse/SOLR-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13483292#comment-13483292
 ] 

Jonathan Cummins commented on SOLR-3390:
----------------------------------------

I think you can fix it by using a "custom" synonym filter factory and without 
setting the "luceneMatchVersion" to "LUCENE_33" in the solrconfig.xml.

You can just do something like:

package your.package.name;

public class CustomSynonymFilterFactory extends SynonymFilterFactory {
        
        @Override
         public void init(Map<String,String> args){
                this.setLuceneMatchVersion(Version.LUCENE_33);
                super.init(args);
         }
}

And then, in your schema, you can do something like this:

<filter class="your.package.name.CustomSynonymFilterFactory" 
synonyms="synonyms.txt" ignoreCase="true" expand="true"/>

And that will let it use the "SlowSynonymFilter" from solr 3.3 for just the 
synonyms without changing the luceneMatchVersion in solrconfig.xml. It works 
basically by "tricking" the SynonymFilterFactory class into thinking the lucene 
version is 3.3 without it actually being 3.3.

Hope that helps out!

                
> Highlighting issue with multi-word synonyms causes to highlight the wrong 
> terms
> -------------------------------------------------------------------------------
>
>                 Key: SOLR-3390
>                 URL: https://issues.apache.org/jira/browse/SOLR-3390
>             Project: Solr
>          Issue Type: Bug
>          Components: highlighter, query parsers
>    Affects Versions: 3.6
>         Environment: Windows 7. (Development machine, not the server) 
>            Reporter: Rahul Babulal
>              Labels: highlighter, multi-word, solr, synonyms
>
> I am using solr 3.6 and when I have multi-words synonyms the highlighting 
> results have the wrong word highlighted. 
> If I have the below entry in the synonyms file:
> dns, domain name system 
> If I index something like: "A sample dns entry explaining the details".
> Searching for "name" (without quotes) in the highlight results/snippets I get 
> :  "A sample dns <em>entry</em> explaining the details". (The token "entry" 
> overlaps with the token "name" in the analysis.jsp)
> Searching for "system" (without quotes) in the highlight results/snippets I 
> get :  "A sample dns entry <em>explaining</em> the details". (The token 
> "explaining" overlaps with the token "system" in the analysis.jsp)
> Here is my schema field Type:
> <fieldType name="text_general" class="solr.TextField" 
> positionIncrementGap="100">
>       <analyzer type="index">
>         <charFilter class="solr.HTMLStripCharFilterFactory"/>
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" 
> ignoreCase="true" expand="true"/>
>         <filter class="solr.StopFilterFactory" ignoreCase="true" 
> words="stopwords.txt" enablePositionIncrements="true" />
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.PorterStemFilterFactory"/>        
>       </analyzer>
>       <analyzer type="query">
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" 
> ignoreCase="true" expand="false"/>
>         <filter class="solr.StopFilterFactory" ignoreCase="true" 
> words="stopwords.txt" enablePositionIncrements="true" />
>               <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.PorterStemFilterFactory"/>
>       </analyzer>
>     </fieldType>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to