lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: categorisation
Date Fri, 09 Feb 2007 14:05:59 GMT

On Feb 9, 2007, at 7:07 AM, Kainth, Sachin wrote:
> But does that not imply that a second search is made against the index
> by the line:
>
> BitSet all = (new QueryFilter(q)).bits(reader)

Yeah, if you want to return facet counts and results in the same  
sweep, yes.  If all you want are the counts, only one query is needed.

Caching is key.  Solr - See the Light!

	Erik



>
> -----Original Message-----
> From: Kainth, Sachin [mailto:Sachin.Kainth@atkinsglobal.com]
> Sent: 09 February 2007 12:05
> To: java-user@lucene.apache.org
> Subject: RE: categorisation
>
> Ahhh it all makes sense to me now :-)
>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: 09 February 2007 12:01
> To: java-user@lucene.apache.org
> Subject: Re: categorisation
>
>
> On Feb 9, 2007, at 5:40 AM, Kainth, Sachin wrote:
>> It makes sense to me only if you tell me that all the bits in the
>> BitSet "all" will be 1.
>
> well, ok, so the "all" may be misleading.   call it queryBits instead
> then :)
>
> "all" means *all documents that match the query*, though.
>
> it wouldn't make sense to AND a bitset with one that is all 1's  
> always.
>
> 	Erik
>
>
>>
>> -----Original Message-----
>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>> Sent: 08 February 2007 18:37
>> To: java-user@lucene.apache.org
>> Subject: Re: categorisation
>>
>>
>> On Feb 8, 2007, at 12:36 PM, Kainth, Sachin wrote:
>>
>>> Chris has given an example of how to perform categorisation of  
>>> lucene
>>> searches:
>>>
>>> String[] mfgs = ...;
>>>   String query = "+category:cameras +price:[0 to 10]";
>>>   Query q = QueryParser.parse(query);
>>>   Hits results = searcher.search(q, mySort)
>>>   BitSet all = (new QueryFilter(q)).bits(reader)
>>>   int[] mfg_counts = new int[mfgs.length];
>>>   for i in (0 to mfgs.length) {
>>>      BitSet these = (new QueryFilter(new TermQuery("mfg",mfgs
>>> [i]))).bits(reader);
>>>      these.and(all)
>>>      mfg_counts[i] = these.cardinality();
>>>   }
>>>
>>> What I don't understand though is what this line does:
>>>
>>> BitSet all = (new QueryFilter(q)).bits(reader)
>>>
>>> Anyone have any ideas?
>>
>> "all" is a BitSet lit up for the documents that matched "query".
>> "these" (the BitSet for a particular category) is .anded with "all"
>> to get the counts _left over_ for each category given "query".
>>
>> Make sense?
>>
>> 	Erik
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>>
>> This message has been scanned for viruses by MailControl - (see
>> http://bluepages.wsatkins.co.uk/?4318150)
>>
>>
>> This email and any attached files are confidential and copyright
>> protected. If you are not the addressee, any dissemination of this
>> communication is strictly prohibited. Unless otherwise expressly
>> agreed in writing, nothing stated in this communication shall be
>> legally binding.
>>
>> The ultimate parent company of the Atkins Group is WS Atkins plc.
>> Registered in England No. 1885586.  Registered Office Woodcote Grove,
>> Ashley Road, Epsom, Surrey KT18 5BW.
>>
>> Consider the environment. Please don't print this e-mail unless you
>> really need to.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


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


Mime
View raw message