views:

46

answers:

2

I have an application that store (title,body) of a news as separate field in lucene document At search time i need to create a query that boost title over body. (title is more important in search) but it slow down the speed of searching. An optimization tip show me that I can combine these two fields into one and It absolutely speed up search and indexing, but I loose scoring that i want to catch at searching (boost title over body)

Is there anyway to combine the benefits ?

A: 

You could also try boosting at index time. For example,

Document doc = new Document();
Field f = new Field(...)
f.setBoost(10f); // or choose a float value of choice
doc.Add(f);

But still unclear on why you have performance problems with searching with search time boosts. Usually no noticeable loss, if any.

Mikos
A: 

The easiest way to boost title more than body and index them in the same field is to add title's text multiple times.

Or you can use payloads and override Similarity. See:

http://www.lucidimagination.com/blog/2009/08/05/getting-started-with-payloads/

I doubt either of these solutions will give you that much of a speed improvement though.

bajafresh4life
adding title field is tricky ideaThank you
Ehsan
Yes it absolutely speed things up look at thehttp://wiki.apache.org/lucene-java/ImproveIndexingSpeedIn my case i don't need to store title or body I just want them to be indexed so the best approach would be combine them to speed indexing and searching
Ehsan