lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Rowe <>
Subject Re: Sorting in a particular case
Date Mon, 12 Feb 2007 14:43:13 GMT
jreeman wrote:
> could you tell me what is the value of the score of the hits when the
> query contains only criteria on metadata looking something like that
> : domains:domain1 or domains:all_domains ?

FYI, if you're using the Java version of Lucene, more people listen to
the java-user@l.a.o list than to this list (general@l.a.o).

Assuming you're using QueryParser, you should be using "OR" instead of
"or" for the operator.  Incidentally, QueryParser's default operator is
already "OR", so unless you've changed the default operator[1], the
following two queries are equivalent:

    domains:domain1 OR domains:all_domains

    domains:domain1 domains:all_domains

To sort documents that match the more specific component of the query
higher, give the more specific component a boost, e.g. (below is a
QueryParser query - note that there are equivalent API methods to set

    domains:domain1^10 domains:all_domains

The default boost is 1, so the above query gives 10 times more weight to
documents that have the "domain1" term than to those with the
"all_domains" term.


[1] QueryParser.setDefaultOperator():

[2] Query.setBoost():

View raw message