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?



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. 

Reply via email to