lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryzek.Michael" <Michael.Bry...@uwa.unitedway.org>
Subject RE: Boosting Fields (in index) or Queries
Date Fri, 14 Apr 2006 17:39:56 GMT
We tried two approaches:

  1) Pull data from the db in arbitrary order and then sort in the application  AFTER the
retrieve. This will require two passes over the results.

  2) Add an order by clause to the select. In Oracle, you could do something like "order by
decode(444,1,333,2,555,3,888,4,...)". This will force the order you want in the query from
the db.

FWIW, after trying both of the above in production, we changed our strategy to avoid the db
hit altogether, storing everything we needed for presentation within the Lucene index. We
saw a net performance increase AND simpler code when we did this.

-Mike

-----Original Message-----
From:	Jeremy Hanna [mailto:jeremy_hanna@mac.com]
Sent:	Fri 4/14/06 1:15 PM
To:	java-user@lucene.apache.org
Cc:	
Subject:	Re: Boosting Fields (in index) or Queries

Wow, I finally found out why I was getting results in the wrong order  
- I got the results in the correct order from the Lucene index.  I  
got the explanation of each of the results along with their database  
id and found the ordering mismatch.
The problem is in the database call.  I am calling:

select * from product where id in (444, 333, 555, 888);

and the ordering that comes back is not preserved.  So the results  
are correct but the ordering and hence all of the relevancy is out  
the window.  So that at least leads me to the actual problem.  Now I  
have to figure out how I'll approach reordering the results because I  
don't believe that there's any way to force the ordering of a list  
and I don't want to call a separate database query for each id (lots  
of database round-trips).

Thanks for the help Erik!

On Apr 13, 2006, at 7:13 PM, Erik Hatcher wrote:

>
> On Apr 13, 2006, at 8:55 PM, Jeremy Hanna wrote:
>> Looking at the results, the first document in the results should  
>> hopefully be near the bottom and the Explanation for this document  
>> has a Description/Details (using the toString() on the  
>> Explanation) of:
>>
>> product of:
>>   0.0 = sum of:
>>   0.0 = coord(0/7)
>>
>> So I'm kind of at a loss as to what's going on.  Am I just doing  
>> something crazy weird in my code?  I didn't find that many  
>> examples out there, so I'm kind of winging it according to what  
>> I've read in the javadocs and what examples I could find.
>
> Be sure to pass the document id, not the hit number, to explain().   
> Looks like you passed an id of an unmatched document.
>
> 	Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message