lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shawn Heisey (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SOLR-11156) Edismax query parser fails to parse q=(*:*)
Date Wed, 21 Feb 2018 08:35:00 GMT

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

Shawn Heisey edited comment on SOLR-11156 at 2/21/18 8:34 AM:
--------------------------------------------------------------

This patch fixes the immediate issue, but sometimes simple and safe-looking changes in low-level
code like this can have unexpected consequences.  Also, this may not actually be the best
way to fix it:

{noformat}
diff --git a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
index 004d1c042a..cf0c931c91 100644
--- a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
@@ -773,7 +773,7 @@ public class ExtendedDismaxQParser extends QParser {
         if(disallowUserField) {
           clause.raw = s.substring(start, pos);
           // escape colons, except for "match all" query
-          if(!"*:*".equals(clause.raw)) {
+          if(!"*:*".equals(clause.raw) && !"(*:*)".equals(clause.raw)) {
             clause.raw = clause.raw.replaceAll("([^\\\\]):", "$1\\\\:");
           }
         } else {
{noformat}



was (Author: elyograg):
This patch fixes the immediate issue, but sometimes simple and safe-looking changes in low-level
code like this can have unexpected consequences:

{noformat}
diff --git a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
index 004d1c042a..cf0c931c91 100644
--- a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
@@ -773,7 +773,7 @@ public class ExtendedDismaxQParser extends QParser {
         if(disallowUserField) {
           clause.raw = s.substring(start, pos);
           // escape colons, except for "match all" query
-          if(!"*:*".equals(clause.raw)) {
+          if(!"*:*".equals(clause.raw) && !"(*:*)".equals(clause.raw)) {
             clause.raw = clause.raw.replaceAll("([^\\\\]):", "$1\\\\:");
           }
         } else {
{noformat}


> Edismax query parser fails to parse q=(*:*)
> -------------------------------------------
>
>                 Key: SOLR-11156
>                 URL: https://issues.apache.org/jira/browse/SOLR-11156
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: query parsers
>    Affects Versions: 5.5.1
>         Environment: Solr 5.5.1
>            Reporter: Alfonso Noriega Meneses
>            Priority: Major
>              Labels: edismax, query-parser, solr
>
> The Edismax query parser does parse the query {{(\*:\*)}} as a exact text match instead
of a match all documents.
> Setting the debugQuery param to true and the query  {{\*:\*}}  we get this json:
> {code}
> "debug": {
>    "rawquerystring": "*:*",
>    "querystring": "*:*",
>    "parsedquery": "(+MatchAllDocsQuery(*:*))/no_coord",
>    "parsedquery_toString": "+*:*",
>    ...
> }
> {code}
> But with the query {{(\*:\*)}} the Edismax query parser returns a {{DisjunctionMaxQuery}}
like shown in the following json:
> {code}
> "debug": {
>    "rawquerystring": "(*:*)",
>    "querystring": "(*:*)",
>    "parsedquery": "(+DisjunctionMaxQuery((text:*\\:*)))/no_coord",
>    "parsedquery_toString": "+(text:*\\:*)",
>    "explain": {},
>    "QParser": "ExtendedDismaxQParser",
>    ...
> }
> {code}



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

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


Mime
View raw message