On 10/23/06, Walter Lewis <[EMAIL PROTECTED]> wrote:
If I've missed this in the documentation just point me in the right
direction, otherwise ...

Tweaking relevance is a lucene question.  Solr adds almost nothing to
this--the various documents pertaining to lucene are most relevant.

Note that my ad-hoc knowledge of lucene query parser syntax is shaky,
so treat the examples as just that.

I'm interested in ways of tweaking result sets based on criteria
external to the search itself. For example:

    user searches for "foo AND bar" in a general "text" search
    search returns 100 records

I don't want to change the records in the set but just shuffle the order by
    boost the records with both foo and bar in the title field

Adjust your query.  Add title:(foo AND bar)^10

    boost the records with "foo bar" ahead of those with "foo, baz, bop
and bar"

Add an optional phrase query to your main query (note: dismax handler
can do this automatically)

    boost the records with a 5 rating, more than those with a 4, or a 3

Use document boosts at index time, or function queries.

    boost the records where hasComment is true over those hasComment is
false

Use document boosts at index time.

    boost really long records with lots of foo's and bar's relative to
the short record
        (what I tend to call "the lousy metadata wins" problem)

I don't really understand this one--this is typically the opposite of
what is needed.  However, this can be done by overriding the
Similarity class (and pointing solr at your custom class).

Note that the dismax handler already has facilities for doing many of
the tasks you require.  For instance, arbitrary "boost queries" can be
added to a query to tweak relevance.  You can specify a set of fields
with varying boosts over which a term will be searched, with a
corresponding set of fields for phrase queries.

The only really tricky thing to adjust here is the Similarity class,
which  requires lots of experiementation--changes tend to have
far-reaching consequences.  Other factors can be played with more
readily.  debugQuery=true is your friend.

-Mike

Reply via email to