lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksander M. Stensby" <>
Subject Re: Sorting & SQL-Database
Date Sat, 01 Jul 2006 08:27:00 GMT
Well, it is common in most databasesystems, that if you dont specify a  
sort, you get the results sorted by id, or by when the rows are inserted  
into the db.

The quickest way for you is to write around your query.
instead of doing one query, just do where queries with equals. this would  
produce a bit overflow if you have your database on an external server,  
but again, the quickest query to ever run in sql are equals-queries. Since  
the ID is unique (i hope so), it should be no problem at all.
... WHERE id = 2;
... WHERE id = 3
... WHERE id = 19
and so on would give you the correct relevance-order.

On Sat, 01 Jul 2006 10:09:01 +0200, karl wettin <> wrote:

> On Sat, 2006-07-01 at 01:10 +0200, Dominik Bruhn wrote:
>> SELECT id,addfield FROM table WHERE id IN ([LUCENERESULT]);
>> Where LUCENERESULT is like 2,3,19,3,5.
>> This works fine but got one problem: The Search-Result of Lucene is  
>> order by
>> relevance and so the id-list is also sorted by relevance. But the  
>> result of
>> the SQL-Query is sorted by the id which destroys the relevance-sorting.
>> Does anybody know a work-arround?
> This is really a question you should ask in the forum of your RDBMS. You
> could always execute multiple SQL-queries within the same statement
> without too much loss. But I'm certain there is a way to enforce the
> order as you specified it in the WHERE-clause.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Aleksander M. Stensby
Software Developer
Integrasco A/S
Tlf.: +47 41 22 82 72

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message