wiki:FAQ/StrictBoolean

How can I implement a strict boolean query?

To perform a strict boolean query, you need to tell Xapian to use the boolean weighting scheme. Setting the boolean weighting scheme can be done (in C++ syntax) like this:

enquire.set_weighting_scheme(Xapian::BoolWeight());

or in Xapian 1.0.4 and later you can scale all the weights in the query by a factor of zero to achieve the same effect:

query = Xapian::Query(query.OP_SCALE_WEIGHT, query, 0);

Both approaches end up being handled the same way after query optimisation, so use whichever is most convenient for you.

FAQ Index

Last modified 8 months ago Last modified on 28/02/19 22:58:31