lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Schnober <>
Subject Re: UnsupportedOperationException: Query should have been rewritten
Date Tue, 14 Aug 2012 09:06:38 GMT
Am 14.08.2012 11:00, schrieb Uwe Schindler:
> You have to rewrite the wrapper query.

Thanks, Uwe! I had tried that way but it failed because the rewrite()
method would return a Query (not a SpanQuery) object. A cast seems to
solve the problem, I'm re-posting the code snippet to the list for the
sake of completeness:

WildcardQuery wildcard = new WildcardQuery(new Term("field", "bro*"));
SpanQuery query = (SpanQuery) new
Spans spans = query.getSpans(reader);

All I am still wondering about is whether this cast is totally safe,
i.e. robust to all kinds of variable search terms.


Institut für Deutsche Sprache |
Projekt KorAP                 |
Tel. +49-(0)621-43740789      |
Korpusanalyseplattform der nächsten Generation
Next Generation Corpus Analysis Platform

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message