You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by "Shivanadhuni, Saikrishna" <sa...@spglobal.com> on 2021/06/24 12:57:26 UTC

Synonym Graph Filter with phrase match - Query.

Hi Team,

Hope you are doing well.

We need your help in achieving one of my use case with SynonymGraphFilter factory.

Problem:
Replace the right hand side phrase from synonym file even when user searching with double quotes or phrase match.

Example:


  1.  I am using below filter factory and I have one synonym mentioned in the synonyms text file i.e. abc => summary
  2.  When user is searching with phrase match/exact match my query looks like below



q = "abc"^2 OR abc^1     [My intention here is to get an output which is having exact "summary" will get double score rather than having with other combination like "summary test"]

qf = test_synonym_field

Below is my filter in schema.xml:
<fieldType name="test_synonym" class="solr.TextField" positionIncrementGap="100" multiValued="false" omitNorms="true">
    <analyzer type="index">
      <tokenizer class="solr.WhiteSpaceTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.SynonymGraphFilterFactory" synonyms="Synonyms.txt" ignoreCase="true" expand="true"/>
      <filter class="solr.FlattenGraphFilterFactory"/> <!-- required on index analyzers after graph filters -->
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.WhiteSpaceTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.SynonymGraphFilterFactory" synonyms="Synonyms.txt" ignoreCase="true" expand="true"/>
    </analyzer>
  </fieldType>


  1.  When I ran my SOLR, query with above query params, I am getting results which are matching with "summary" along with some other words on top.



My expectation is to get more score to the field value which is having exact word "Summary" on top.


Please suggest/help me to get my outcome by suggesting a solution.


Appreciate your support on this aspect.



Regards
Saikrishna S (SSK)
Senior Software Developer
CONTENT SYSTEMS DEVELOPMENT
S&P Global - 91 9550897735
[cid:image001.png@01D76920.6B4A9980]


________________________________

The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. S&P Global Inc. reserves the right, subject to applicable local law, to monitor, review and process the content of any electronic message or information sent to or from S&P Global Inc. e-mail addresses without informing the sender or recipient of the message. By sending electronic message or information to S&P Global Inc. e-mail addresses you, as the sender, are consenting to S&P Global Inc. processing any of your personal data therein.

RE: Synonym Graph Filter with phrase match - Query.

Posted by "Shivanadhuni, Saikrishna" <sa...@spglobal.com>.
Hi Team,

Any update on my request.

Regards
Saikrishna S (SSK)
Senior Software Developer
CONTENT SYSTEMS DEVELOPMENT
S&P Global - 91 9550897735
[cid:image001.png@01D76D10.9C99D2F0]

From: Shivanadhuni, Saikrishna
Sent: Thursday, June 24, 2021 6:27 PM
To: 'users@solr.apache.org' <us...@solr.apache.org>
Subject: Synonym Graph Filter with phrase match - Query.

Hi Team,

Hope you are doing well.

We need your help in achieving one of my use case with SynonymGraphFilter factory.
Problem:
Replace the right hand side phrase from synonym file even when user searching with double quotes or phrase match.

Example:


  1.  I am using below filter factory and I have one synonym mentioned in the synonyms text file i.e. abc => summary
  2.  When user is searching with phrase match/exact match my query looks like below



q = "abc"^2 OR abc^1     [My intention here is to get an output which is having exact "summary" will get double score rather than having with other combination like "summary test"]

qf = test_synonym_field

Below is my filter in schema.xml:
<fieldType name="test_synonym" class="solr.TextField" positionIncrementGap="100" multiValued="false" omitNorms="true">
    <analyzer type="index">
      <tokenizer class="solr.WhiteSpaceTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.SynonymGraphFilterFactory" synonyms="Synonyms.txt" ignoreCase="true" expand="true"/>
      <filter class="solr.FlattenGraphFilterFactory"/> <!-- required on index analyzers after graph filters -->
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.WhiteSpaceTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.SynonymGraphFilterFactory" synonyms="Synonyms.txt" ignoreCase="true" expand="true"/>
    </analyzer>
  </fieldType>


  1.  When I ran my SOLR, query with above query params, I am getting results which are matching with "summary" along with some other words on top.



My expectation is to get more score to the field value which is having exact word "Summary" on top.


Please suggest/help me to get my outcome by suggesting a solution.


Appreciate your support on this aspect.



Regards
Saikrishna S (SSK)
Senior Software Developer
CONTENT SYSTEMS DEVELOPMENT
S&P Global - 91 9550897735
[cid:image001.png@01D76D10.9C99D2F0]


________________________________

The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. S&P Global Inc. reserves the right, subject to applicable local law, to monitor, review and process the content of any electronic message or information sent to or from S&P Global Inc. e-mail addresses without informing the sender or recipient of the message. By sending electronic message or information to S&P Global Inc. e-mail addresses you, as the sender, are consenting to S&P Global Inc. processing any of your personal data therein.