Luke does not support `spanNear` queries
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
### Description
The following query
```
+((id:*me*)^0.6 (label:*me*)^1.2 (group:*me*)^0.9 (renderer:*me*)^0.9 (prettyFormula:*me*)^0.1) +((id:*sa*)^0.6 (label:*sa*)^1.2 (group:*sa*)^0.9 (renderer:*sa*)^0.9 (prettyFormula:*sa*)^0.1) +((id:*qu*)^0.6 (label:*qu*)^1.2 (group:*qu*)^0.9 (renderer:*qu*)^0.9 (prettyFormula:*qu*)^0.1) spanNear([fullLabel:me, fullLabel:sa, fullLabel:qu], 2, true)
```
will result in
```java
Jul 16, 2024 2:10:52 PM org.apache.lucene.luke.app.desktop.util.ExceptionHandler handle
WARNING: Uncaught LukeException
org.apache.lucene.luke.models.LukeException: Failed to parse query expression: +((id:*me*)^0.6 (label:*me*)^1.2 (group:*me*)^0.9 (renderer:*me*)^0.9 (prettyFormula:*me*)^0.1) +((id:*sa*)^0.6 (label:*sa*)^1.2 (group:*sa*)^0.9 (renderer:*sa*)^0.9 (prettyFormula:*sa*)^0.1) +((id:*qu*)^0.6 (label:*qu*)^1.2 (group:*qu*)^0.9 (renderer:*qu*)^0.9 (prettyFormula:*qu*)^0.1) spanNear([fullLabel:me, fullLabel:sa, fullLabel:qu], 2, true)
at org.apache.lucene.luke@9.11.1/org.apache.lucene.luke.models.search.SearchImpl.parseByStandardParser(SearchImpl.java:247)
at org.apache.lucene.luke@9.11.1/org.apache.lucene.luke.models.search.SearchImpl.parseQuery(SearchImpl.java:151)
at org.apache.lucene.luke@9.11.1/org.apache.lucene.luke.app.desktop.components.SearchPanelProvider.parse(SearchPanelProvider.java:612)
at org.apache.lucene.luke@9.11.1/org.apache.lucene.luke.app.desktop.components.SearchPanelProvider.execParse(SearchPanelProvider.java:498)
at org.apache.lucene.luke@9.11.1/org.apache.lucene.luke.app.desktop.components.SearchPanelProvider$ListenerFunctions.execParse(SearchPanelProvider.java:757)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
...
Caused by: INVALID_SYNTAX_CANNOT_PARSE: Syntax Error, cannot parse +((id:*me*)^0.6 (label:*me*)^1.2 (group:*me*)^0.9 (renderer:*me*)^0.9 (prettyFormula:*me*)^0.1) +((id:*sa*)^0.6 (label:*sa*)^1.2 (group:*sa*)^0.9 (renderer:*sa*)^0.9 (prettyFormula:*sa*)^0.1) +((id:*qu*)^0.6 (label:*qu*)^1.2 (group:*qu*)^0.9 (renderer:*qu*)^0.9 (prettyFormula:*qu*)^0.1) spanNear([fullLabel:me, fullLabel:sa, fullLabel:qu], 2, true):
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.generateParseException(StandardSyntaxParser.java:2098)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.jj_consume_token(StandardSyntaxParser.java:1961)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.TermRangeExpr(StandardSyntaxParser.java:1111)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.Term(StandardSyntaxParser.java:1029)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.Clause(StandardSyntaxParser.java:290)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.ModClause(StandardSyntaxParser.java:249)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.ConjQuery(StandardSyntaxParser.java:186)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.DisjQuery(StandardSyntaxParser.java:163)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.Query(StandardSyntaxParser.java:124)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.GroupingExpr(StandardSyntaxParser.java:331)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.Clause(StandardSyntaxParser.java:294)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.ModClause(StandardSyntaxParser.java:249)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.ConjQuery(StandardSyntaxParser.java:186)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.DisjQuery(StandardSyntaxParser.java:163)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.Query(StandardSyntaxParser.java:124)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.TopLevelQuery(StandardSyntaxParser.java:114)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.parse(StandardSyntaxParser.java:92)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.core.QueryParserHelper.parse(QueryParserHelper.java:214)
at org.apache.lucene.queryparser@9.11.1/org.apache.lucene.queryparser.flexible.standard.StandardQueryParser.parse(StandardQueryParser.java:279)
at org.apache.lucene.luke@9.11.1/org.apache.lucene.luke.models.search.SearchImpl.parseByStandardParser(SearchImpl.java:244)
... 39 more
```
While
```java
Query endQuery = queryBuilder.build();
TopDocs results = dataSearcher.query(endQuery);
```
has no problem with it
### Version and environment details
_No response_
Contributor guide
Research direction
Reproduce the query in Luke and start with SearchImpl.java, especially parseByStandardParser and parseQuery, then trace the call from SearchPanelProvider.java. Compare the failing standard-parser path with the working queryBuilder path shown in the report. Done means the supplied spanNear query parses and executes in Luke without the reported exception, with a regression test if the relevant test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100