[ 
https://issues.apache.org/jira/browse/LUCENE-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703288#action_12703288
 ] 

Earwin Burrfoot commented on LUCENE-1616:
-----------------------------------------

bq. > Span*Query api is a perfect example.
bq. Can you describe the limitations here in more detail?
Take a look at SpanNearQuery and SpanOrQuery.

1. They don't provide incremental construction (i.e. add() method, like in 
BooleanQuery), and they can be built only from an array of subqueries. So, if 
you don't know exact amount of subqueries upfront, you're busted. You have to 
use ArrayList, which you convert to array to feed into SpanQuery, which is 
converted back to ArrayList inside!!
2. They can't be edited. If you have a need to iterate over your query tree and 
modify it in one way or another, you need to create brand new instances of 
Span*Query. And here you hit #1 again, hard.
3. They can't be even inspected without creating a new array from the backing 
list (see getClauses).

I use patched versions of SpanNear/OrQueries, which still use backing 
ArrayList, but accept it in constructor, have utility 'add' method and 
getClauses() returns this very list, which allows for zero-cost inspection and 
easy modification if the need arises.

> add one setter for start and end offset to OffsetAttribute
> ----------------------------------------------------------
>
>                 Key: LUCENE-1616
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1616
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1616.patch, LUCENE-1616.patch, LUCENE-1616.patch
>
>
> add OffsetAttribute. setOffset(startOffset, endOffset);
> trivial change, no JUnit needed
> Changed CharTokenizer to use it

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to