but its a per-document if for the normal case of ranked results, just to look "pretty" ?!
On Wed, Sep 7, 2011 at 9:36 AM, Martijn v Groningen <martijn.v.gronin...@gmail.com> wrote: > I think that a boolean or enum as return value is neater (api wise) than > throwing an expection. > > On 7 September 2011 15:34, Anne Veling <a...@beyondtrees.com> wrote: >> >> Yes, I saw that. I would expect that to be slower. It also would not >> always work as expected if the collector would be combined in a booleanquery >> I guess. >> Anne n >> >> On Wed, Sep 7, 2011 at 15:29, Robert Muir <rcm...@gmail.com> wrote: >>> >>> On Wed, Sep 7, 2011 at 9:09 AM, Anne Veling <a...@beyondtrees.com> wrote: >>> > Ah thanks. I will make the change, ensure all tests are succeeding, add >>> > some >>> > tests of my own, and commit a patch. Would be great to get a feeling of >>> > the >>> > performance impact. >>> > The change I'm making is changing the Collector interface from >>> > public void collect(int doc) to >>> > public boolean collect(int doc) >>> > With a default "false" return code. If a collector returns "true" the >>> > caller >>> > may stop collecting. So all normal collectors would simply return >>> > "false". >>> > This could introduce some performance overhead of adding a return value >>> > to >>> > the call stack, and some checking in the calling code. >>> > However, for some other use cases, like >>> > >>> >>> usually the trick here to stop collecting is to throw a >>> runtimeexception (your own subclass that you can catch), like >>> timelimitingcollector. >>> >>> -- >>> lucidimagination.com >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org >>> For additional commands, e-mail: dev-h...@lucene.apache.org >>> >> >> >> >> -- >> Anne Veling >> BeyondTrees.com >> +31 6 50 969 170 >> @anneveling >> > > > > -- > Met vriendelijke groet, > > Martijn van Groningen > -- lucidimagination.com --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org