lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roman Chyla (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LUCENE-7481) SpanPayloadCheckQuery is missing rewrite method
Date Thu, 06 Oct 2016 22:10:20 GMT

     [ https://issues.apache.org/jira/browse/LUCENE-7481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Roman Chyla updated LUCENE-7481:
--------------------------------
    Description: 
If used with a wildcard query, the result is a failure saying: "Rewrite query first"

The SpanNearQuery has the rewrite method; however the SpanPayloadCheckQuery just returns the
query itself. 

this works:

```
spanNear([vectrfield:ebyuugz, SpanMultiTermQueryWrapper(vectrfield:e*), SpanMultiTermQueryWrapper(vectrfield:m*),
SpanMultiTermQueryWrapper(vectrfield:f*)], 0, true)
```

code to generate the query:

```
private Query getSpanQuery(String[] parts, int howMany, boolean truncate) throws UnsupportedEncodingException
{
		SpanQuery[] clauses = new SpanQuery[howMany+1];
		clauses[0] = new SpanTermQuery(new Term("vectrfield", parts[0])); // surname
		for (int i = 0; i < howMany; i++) {
			if (truncate) {
			  SpanMultiTermQueryWrapper<WildcardQuery> q = new SpanMultiTermQueryWrapper<WildcardQuery>(new
WildcardQuery(new Term("vectrfield", parts[i+1].substring(0, 1) + "*")));
				clauses[i+1] = q;
			}
			else {
				clauses[i+1] = new SpanTermQuery(new Term("vectrfield", parts[i+1]));
			}
		}
		SpanNearQuery sq = new SpanNearQuery(clauses, 0, true); // match in order
		return sq;
	}
```

and this fails:

```
spanPayCheck(spanNear([vectrfield:ebyuugz, SpanMultiTermQueryWrapper(vectrfield:e*), SpanMultiTermQueryWrapper(vectrfield:m*),
SpanMultiTermQueryWrapper(vectrfield:f*)], 1, true), payloadRef: 0;1;2;3;)
```

each clause is made of:

```
new SpanMultiTermQueryWrapper<WildcardQuery>(new WildcardQuery(new Term("vectrfield",
parts[i+1].substring(0, 1) + "*")));
```

It is a regression; the code was working well in SOLR4.x


  was:
If used with a wildcard query, the result is a failure saying: "Rewrite query first"

The SpanNearQuery has the rewrite method; however the SpanPayloadCheckQuery just returns the
query itself. 

this works:

```
spanNear([vectrfield:ebyuugz, SpanMultiTermQueryWrapper(vectrfield:e*), SpanMultiTermQueryWrapper(vectrfield:m*),
SpanMultiTermQueryWrapper(vectrfield:f*)], 0, true)
```

code to generate the query:

```
private Query getSpanQuery(String[] parts, int howMany, boolean truncate) throws UnsupportedEncodingException
{
		SpanQuery[] clauses = new SpanQuery[howMany+1];
		clauses[0] = new SpanTermQuery(new Term("vectrfield", parts[0])); // surname
		for (int i = 0; i < howMany; i++) {
			if (truncate) {
			  SpanMultiTermQueryWrapper<WildcardQuery> q = new SpanMultiTermQueryWrapper<WildcardQuery>(new
WildcardQuery(new Term("vectrfield", parts[i+1].substring(0, 1) + "*")));
				clauses[i+1] = q;
			}
			else {
				clauses[i+1] = new SpanTermQuery(new Term("vectrfield", parts[i+1]));
			}
		}
		SpanNearQuery sq = new SpanNearQuery(clauses, 0, true); // match in order
		return sq;
	}
```

and this fails:

{code:java}
spanPayCheck(spanNear([vectrfield:ebyuugz, SpanMultiTermQueryWrapper(vectrfield:e*), SpanMultiTermQueryWrapper(vectrfield:m*),
SpanMultiTermQueryWrapper(vectrfield:f*)], 1, true), payloadRef: 0;1;2;3;)
{/code}

each clause is made of:

```
new SpanMultiTermQueryWrapper<WildcardQuery>(new WildcardQuery(new Term("vectrfield",
parts[i+1].substring(0, 1) + "*")));
```

It is a regression; the code was working well in SOLR4.x



> SpanPayloadCheckQuery is missing rewrite method
> -----------------------------------------------
>
>                 Key: LUCENE-7481
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7481
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 6.x
>            Reporter: Roman Chyla
>
> If used with a wildcard query, the result is a failure saying: "Rewrite query first"
> The SpanNearQuery has the rewrite method; however the SpanPayloadCheckQuery just returns
the query itself. 
> this works:
> ```
> spanNear([vectrfield:ebyuugz, SpanMultiTermQueryWrapper(vectrfield:e*), SpanMultiTermQueryWrapper(vectrfield:m*),
SpanMultiTermQueryWrapper(vectrfield:f*)], 0, true)
> ```
> code to generate the query:
> ```
> private Query getSpanQuery(String[] parts, int howMany, boolean truncate) throws UnsupportedEncodingException
{
> 		SpanQuery[] clauses = new SpanQuery[howMany+1];
> 		clauses[0] = new SpanTermQuery(new Term("vectrfield", parts[0])); // surname
> 		for (int i = 0; i < howMany; i++) {
> 			if (truncate) {
> 			  SpanMultiTermQueryWrapper<WildcardQuery> q = new SpanMultiTermQueryWrapper<WildcardQuery>(new
WildcardQuery(new Term("vectrfield", parts[i+1].substring(0, 1) + "*")));
> 				clauses[i+1] = q;
> 			}
> 			else {
> 				clauses[i+1] = new SpanTermQuery(new Term("vectrfield", parts[i+1]));
> 			}
> 		}
> 		SpanNearQuery sq = new SpanNearQuery(clauses, 0, true); // match in order
> 		return sq;
> 	}
> ```
> and this fails:
> ```
> spanPayCheck(spanNear([vectrfield:ebyuugz, SpanMultiTermQueryWrapper(vectrfield:e*),
SpanMultiTermQueryWrapper(vectrfield:m*), SpanMultiTermQueryWrapper(vectrfield:f*)], 1, true),
payloadRef: 0;1;2;3;)
> ```
> each clause is made of:
> ```
> new SpanMultiTermQueryWrapper<WildcardQuery>(new WildcardQuery(new Term("vectrfield",
parts[i+1].substring(0, 1) + "*")));
> ```
> It is a regression; the code was working well in SOLR4.x



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message