Yes, this is perfectly doable. In Lucene's speech, weighting is called
boosting. If you search for Lucene and boost you will find plenty. The
Apache lucene doc server seems to be down for now, so I can't post the
correct links.

If you are using QueryParser to generate the query, then the syntax is
to add ^W where weight is a positive number, e.g. if searching an email
database for the term Fred

from:Fred^10 to:Fred^10 subject:Fred^5 Fred

>From memory, if you are using the API purely then you use
TermQuery.setBoost(w)

The default boost (weight) for terms is 1.

There are alternative approaches for regular searches with the same
boostings. MultiFieldQueryParser (not sure if this has made it through
to Lucene.Net yet) and setting a weight on indexing. The latter makes it
necessary to reindex if you change your boost ratios though.

Yours,
Moray
------------------------------------- 
Moray McConnachie
Director of IT    +44 1865 261 600
Oxford Analytica  http://www.oxan.com

-----Original Message-----
From: Michael McGranahan [mailto:[email protected]] 
Sent: 27 August 2009 20:09
To: [email protected]
Subject: field weighting

Hello,

I am in the process of porting an application written in Ruby on Rails
using Thinking Sphinx, to .NET.  I am investigating the use of
Lucene.net to provide search functionality. The existing application
uses a feature of Thinking Sphinx to increase the weight of terms from
particular fields at the time of the search. My colleagues and I have
perused various Lucene.net resources (official documentation, blog
articles, mailing list archives) as well as searching Google in general,
but haven't found this functionality in Lucene.net.  Is this possible in
Lucene.net?  It is not necessary that the weight adjustment occur at
search time since the application only requires one (field-weighted)
query over the documents.

Thank you.

--
Michael McGranahan
<[email protected]>


Reply via email to