lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: Making TopDocCollector a bit more consumable
Date Mon, 24 Aug 2009 14:40:12 GMT
I was just going to add actually:

Yes you can just use the other Searcher methods. Perhaps thats just
fine. I don't think this a large issue.

But you could also use void search(Weight weight, Filter filter,
Collector collector).

I've created my own TopDocs collectors for a handful of reasons in the past.

So I don't think this is a huge deal, but if you used the TopDoc
collectors in the past,
you just had to pass sort/numDocs - now that they are deprecated, if you
happened to be
using it - you go over to the new classes (after finding the new static
factories) and are likely not sure what options to pick. Why not allow
the same
params and pick defaults that always work? People that want to eek out
speed can tweak the
longer param list.

I agree - its not a huge deal - I guess it is more advanced use - but it
was much easier to follow
and use with the deprecated versions. Its gotten quite a bit more confusing.

I'd still want to be able to play around with Collectors without being
an expert.

Just an idea though - I don't think its 100% necessary. When I see
advanced options that are more for optimization though,
I like to have defaults so that I don't have to understand everything
perfectly before I use it.

- Mark

Yonik Seeley wrote:
> But creating the collector is expert use, right?
> The normal use would be from Searcher:
> TopDocs search(Query query, int n)
> TopDocs search(Query query, Filter filter, int n)
>
>
> -Yonik
> http://www.lucidimagination.com
>
>
>
> On Mon, Aug 24, 2009 at 10:15 AM, Mark Miller<markrmiller@gmail.com> wrote:
>   
>> Hey all,
>>
>> Hits, which used to be the non expert search API has been deprecated -
>> so TopDocs is now
>> essentially the non expert search API. But when you go to use it you are
>> greeted with:
>>
>>  public static TopFieldCollector create(Sort sort, int numHits,
>>      boolean fillFields, boolean trackDocScores, boolean trackMaxScore,
>>      boolean docsScoredInOrder)
>>
>> and
>>
>>  public static TopScoreDocCollector create(int numHits, boolean
>> docsScoredInOrder) {
>>
>>    if (docsScoredInOrder) {
>>      return new InOrderTopScoreDocCollector(numHits);
>>    } else {
>>      return new OutOfOrderTopScoreDocCollector(numHits);
>>    }
>>
>>  }
>>
>> Woah ! Think of the poor noobies ;)
>>
>> I don't know if I want my docs scored in order. Seriously, I don't. Its
>> sounds nice though. And fill fields? Please do I guess :)
>>
>> What do you think about having versions that default to something
>> reasonable ? And you just have to give numhits and sort, numhits?
>>
>> This API now has a dual role IMO - expert and non expert.
>>
>> --
>> - Mark
>>
>> http://www.lucidimagination.com
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>   


-- 
- Mark

http://www.lucidimagination.com




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


Mime
View raw message