You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by elisabeth benoit <el...@gmail.com> on 2024/08/27 15:40:02 UTC
MultiWords Synonyms with ShingleFilterFactory and SynonymGraphFilterFactory in SolR 9.2.1
Hello,
I'm trying to find a solution for multiwords synonyms in solr 9.2.1.
We cannot use sow=false because our different fields have different
stopwords and synonyms, ie they are not consistently analyzed and we dont
want SolR to use a field centric query ((as explained here:
https://opensourceconnections.com/blog/2018/02/20/edismax-and-multiterm-synonyms-oddities/
).
I'm trying the solution described here (
https://opensourceconnections.com/blog/2016/12/02/solr-elasticsearch-synonyms-better-patterns-keyphrases/)
but in SolR instead of ES, so I have a field define as
<fieldType name="multiwords_synonyms" class="solr.TextField"
positionIncrementGap="100">
<analyzer type="index">
<tokenizer name="standard" />
<charFilter class="solr.MappingCharFilterFactory"
mapping="mapping-ISOLatin1Accent.txt" />
<filter name="lowercase"/>
</analyzer>
<analyzer type="query">
<tokenizer name="standard" />
<charFilter class="solr.MappingCharFilterFactory"
mapping="mapping-ISOLatin1Accent.txt" />
<filter name="lowercase" />
<filter class="solr.ShingleFilterFactory" maxShingleSize="3"
minShingleSize="3" outputUnigrams="false"/>
<filter class="solr.SynonymGraphFilterFactory"
synonyms="multiwords_synonyms.txt" ignoreCase="true"
expand="true"/>
<filter name="flattenGraph"/>
<filter class="solr.KeepWordFilterFactory"
words="has_multiwords_synonym.txt" />
</analyzer>
</fieldType>
Where multiwords_synonyms.txt contains the line
hotel\ de\ ville=>mairie
but it doesnt work on the query side, with the query "hôtel de ville
paris" I have the shingle "hotel de ville" but the synonym hotel\ de\
ville=>mairie doesnt match with the ShingleFilterFactory output.
If someone has a clue it would be greatly appreciated.
Best regards,
Elisabeth