Mailing List Archive

Calculating costs of queries
Hello, my name is Nir and I’m a big fan of Lucene.
Lately I have investigated the inner classes of Lucene to understand
things like the order a conjunction query is executed.

A strange situation happened to me when I compose a Boolean query with
a term query and a prefix query.

I found that the cost of the prefix query was much lower than the cost
of the term query although it has much more docs associated with it.

I tried to understand the calculation of the cost of a prefix query
but found it unclear. (counter / termsPerDoc).

I would be very happy if someone would be able to explain me the calculation.

In Addition I would like to make sure I understand the cost() function
correctly. Isn’t it suppose to help the iterators of a query iterate
the least they can?



Thanks in advance