luwak
luwak copied to clipboard
error=uk.co.flax.luwak.util.RewriteException
I have added a query- "plans to eat" in the monitor with id "query1-plans to eat", and my document has a substring plans to eat. While iterating over the matches, this query gets matched but is unable to give the hit. During debugging i get this
"Match(doc=doc-1,query=query1-plans to eat){error=uk.co.flax.luwak.util.RewriteException: Don't know how to rewrite PhraseQuery with holes or overlaps (position must increase by 1 each time but found term document:plans at position 0 followed by term document:eat at position 2)} "
I guess this problem is because of stop words.
The code i used is like this
for (HighlightsMatch docMatch : docMatches) {
Set<Hit> hits = docMatch.getHits().get("document");
List<String> phrasesMatched = new ArrayList<String>();
String phrase = "";
int oldPosition = 0;
int newOffset = 0;
System.out.println("hit count for "+docMatch.getQueryId().split("---")[1]+" "+docMatch.getHitCount());
if(hits != null) {
.....some code
}
signalPhraseMap.put(docMatch.getQueryId(), phrasesMatched);
}
when the docMatch gets to "plans to eat" it is unable to give the hit.
SpanNearQuery actually has the ability to add defined gaps now, so it should be possible to handle stop words correctly. Do you want to work on a PR?