[ https://issues.apache.org/jira/browse/SOLR-11022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16402325#comment-16402325 ]
Diogo Guilherme Leão Edelmuth commented on SOLR-11022: ------------------------------------------------------ Hi, [~jimczi], Is the following file the reason for this error? {color:#333333}[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:#333333}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: > <fieldType name="text_pt_synonyms_ascii_minimal_lightStem" > class="solr.TextField" positionIncrementGap="100"> > <analyzer type="index"> > <tokenizer class="solr.StandardTokenizerFactory"/> > <filter class="solr.LowerCaseFilterFactory"/> > <filter class="solr.StopFilterFactory" format="snowball" > words="lang/stopwords_pt.txt" ignoreCase="true"/> > <filter class="solr.PortugueseLightStemFilterFactory"/> > </analyzer> > <analyzer type="query"> > <tokenizer class="solr.StandardTokenizerFactory"/><filter > class="solr.LowerCaseFilterFactory"/> > <filter class="solr.StopFilterFactory" format="snowball" > words="lang/stopwords_pt.txt" ignoreCase="true"/><filter > class="solr.ASCIIFoldingFilterFactory" preserveOriginal="true"/> > <filter class="solr.SynonymGraphFilterFactory" expand="true" > ignoreCase="true" synonyms="synonyms_radex.txt"/> > <filter class="solr.PortugueseLightStemFilterFactory"/> > </analyzer> > </fieldType> -- 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