[jira] [Commented] (SOLR-11022) SynonymGraphFilterFactory proximity search error

2018-03-16 Thread JIRA

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

Diogo Guilherme Leão Edelmuth commented on SOLR-11022:
--

 

Hi, [~jimczi],

 

Is the following file the reason for this error? 

{color:#33}[lucene-solr/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java|[https://github.com/apache/lucene-solr/blob/83753d0a2ae5bdd00649f43e355b5a43c6709917/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java]]{color}

 

{color:#33}It just seems to be leaving the SpanNearQuery out.{color}

If so, could we not just add the following, so that it also applies the slop to 
SpanNearQuery?:

 
{code:java}
else if (query instanceof SpanNearQuery) {
    SpanNearQuery snq = (SpanNearQuery)query;
 if (slop != snq.getSlop()) {
  query = new SpanNearQuery.Builder(snq).setSlop(slop).build();
    }
  }
{code}
SpanNearQuery seems to have the same method for applying the slop.

 

Here is how the code is today:
{code:java}
/**
   * Base implementation delegates to {@link 
#getFieldQuery(String,String,boolean,boolean)}.
   * This method may be overridden, for example, to return
   * a SpanNearQuery instead of a PhraseQuery.
   *
   */
  protected Query getFieldQuery(String field, String queryText, int slop)
    throws SyntaxError {
    Query query = getFieldQuery(field, queryText, true, false);
 
    // only set slop of the phrase query was a result of this parser
    // and not a sub-parser.
    if (subQParser == null) {
  if (query instanceof PhraseQuery) { 
<<==
    PhraseQuery pq = (PhraseQuery) query;
    Term[] terms = pq.getTerms();
    int[] positions = pq.getPositions();
    PhraseQuery.Builder builder = new PhraseQuery.Builder();
    for (int i = 0; i < terms.length; ++i) {
  builder.add(terms[i], positions[i]);
    }
    builder.setSlop(slop);
    query = builder.build();
  } else if (query instanceof MultiPhraseQuery) {
<<
    MultiPhraseQuery mpq = (MultiPhraseQuery)query;
 
    if (slop != mpq.getSlop()) {
  query = new MultiPhraseQuery.Builder(mpq).setSlop(slop).build();
    }
  }
    }
    return query;
  }
{code}
 

Thanks for the attention again!

> SynonymGraphFilterFactory proximity search error
> 
>
> Key: SOLR-11022
> URL: https://issues.apache.org/jira/browse/SOLR-11022
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: query parsers
>Affects Versions: 6.6
>Reporter: Diogo Guilherme Leão Edelmuth
>Priority: Major
>  Labels: span, synonym
>
> There seems to be an issue when doing proximity searches that include terms 
> that have multi-word synonyms.
> Example:
> consider there's is configured in synonyms.txt
> (
> grand mother, grandmother
> grandfather, granddad
> )
> and there's an indexed field with: (My mother and my grandmother went...)
> Proximity search with: ("mother grandmother"~8)
> won't return the file, while ("father grandfather"~8) does return the 
> analogous file.
> I am not a developer of Solr, so pardon if I am wrong, but I ran it with 
> debug=query and saw that when proximity searches are done with multi-term 
> synonyms, the called function is spanNearQuery: 
> "parsedquery":"SpanNearQuery(spanNear([laudo:mother,
> spanOr([laudo:grand mother, laudo:grandmother])],*0*, true))"
> while proximity searches with one-term synonyms are executed with:
> "MultiPhraseQuery(laudo:\"father (grandfather granddad)\"~10)"
> Note that the SpanNearQuery is called with a slope parameter of 0, no matter 
> what is passed after the tilde. So if I search the exact phrase it does match.
> Here is my field-type, just in case:
>  class="solr.TextField" positionIncrementGap="100">
> 
> 
> 
>  words="lang/stopwords_pt.txt" ignoreCase="true"/>
> 
> 
> 
>  class="solr.LowerCaseFilterFactory"/>
>  words="lang/stopwords_pt.txt" ignoreCase="true"/> class="solr.ASCIIFoldingFilterFactory" preserveOriginal="true"/>
>  ignoreCase="true" synonyms="synonyms_radex.txt"/>
> 
> 
> 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (SOLR-11022) SynonymGraphFilterFactory proximity search error

2017-07-06 Thread JIRA

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

Diogo Guilherme Leão Edelmuth commented on SOLR-11022:
--

I am sorry, but I am a beginner using the API (can't program in Java) :/
Maybe in the future I will be able to contribute


> SynonymGraphFilterFactory proximity search error
> 
>
> Key: SOLR-11022
> URL: https://issues.apache.org/jira/browse/SOLR-11022
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>Affects Versions: 6.6
>Reporter: Diogo Guilherme Leão Edelmuth
>
> There seems to be an issue when doing proximity searches that include terms 
> that have multi-word synonyms.
> Example:
> consider there's is configured in synonyms.txt
> (
> grand mother, grandmother
> grandfather, granddad
> )
> and there's an indexed field with: (My mother and my grandmother went...)
> Proximity search with: ("mother grandmother"~8)
> won't return the file, while ("father grandfather"~8) does return the 
> analogous file.
> I am not a developer of Solr, so pardon if I am wrong, but I ran it with 
> debug=query and saw that when proximity searches are done with multi-term 
> synonyms, the called function is spanNearQuery: 
> "parsedquery":"SpanNearQuery(spanNear([laudo:mother,
> spanOr([laudo:grand mother, laudo:grandmother])],*0*, true))"
> while proximity searches with one-term synonyms are executed with:
> "MultiPhraseQuery(laudo:\"father (grandfather granddad)\"~10)"
> Note that the SpanNearQuery is called with a slope parameter of 0, no matter 
> what is passed after the tilde. So if I search the exact phrase it does match.
> Here is my field-type, just in case:
>  class="solr.TextField" positionIncrementGap="100">
> 
> 
> 
>  words="lang/stopwords_pt.txt" ignoreCase="true"/>
> 
> 
> 
>  class="solr.LowerCaseFilterFactory"/>
>  words="lang/stopwords_pt.txt" ignoreCase="true"/> class="solr.ASCIIFoldingFilterFactory" preserveOriginal="true"/>
>  ignoreCase="true" synonyms="synonyms_radex.txt"/>
> 
> 
> 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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