[
https://issues.apache.org/jira/browse/LUCENE-6308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14362005#comment-14362005
]
Paul Elschot commented on LUCENE-6308:
--------------------------------------
I'm slowly progressing with this.
There is one change in the test code in TestSpans that nicely shows in a few
lines what this is all about.
It is the code for counting Spans and for counting SpansEnum (which inherits
from DocIdSetIterator).
Both are produced by a Span Not query:
{code}
private int spanCount(String include, String exclude, int pre, int post)
throws IOException {
SpanTermQuery iq = new SpanTermQuery(new Term(field, include));
SpanTermQuery eq = new SpanTermQuery(new Term(field, exclude));
SpanNotQuery snq = new SpanNotQuery(iq, eq, pre, post);
Spans spans = getSpansFromQuery(snq);
int i = 0;
while (spans.next()){
i++;
}
return i;
}
private int spansEnumCount(String include, String exclude, int pre, int post)
throws IOException {
SpansEnumTermQuery iq = new SpansEnumTermQuery(new Term(field, include));
SpansEnumTermQuery eq = new SpansEnumTermQuery(new Term(field, exclude));
SpansEnumNotQuery senq = new SpansEnumNotQuery(iq, eq, pre, post);
SpansEnum spans = getSpansEnumFromQuery(senq);
int i = 0;
if (spans != null) {
while (spans.nextDoc() != SpansEnum.NO_MORE_DOCS){
while (spans.nextStartPosition() != SpansEnum.NO_MORE_POSITIONS) {
i++;
}
}
}
return i;
}
{code}
> SpansEnum, deprecate Spans
> --------------------------
>
> Key: LUCENE-6308
> URL: https://issues.apache.org/jira/browse/LUCENE-6308
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/search
> Reporter: Paul Elschot
> Priority: Minor
> Attachments: LUCENE-6308.patch, LUCENE-6308.patch, LUCENE-6308.patch
>
>
> An alternative for Spans that looks more like PositionsEnum.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]