Exception raised when searching with sorting on an empty index.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Exception raised when searching with sorting on an empty index.

Mathias Herberts
Hi,

I have an instance of MultiSearcher searching two indices, one based
on an FSDirectory, and another one based on a RAMDirectory. The file
based index is static, i.e. no changes are made to it. The RAM based
index is used to add documents.

When starting up, the RAM based index is empty. If I attempt to do a
search for a Term on the MultiSearcher it returns the results from the
file index.

When doing a search with sorting on a field (ts) on the MultiSearcher
with an empty RAM based index, an exception is thrown saying:

no terms in field ts - cannot determine sort type

Unless I'm misunderstanding something it appears to me this is a bug.

I am using Lucene 2.0.0 with JDK 1.4 on Mac OS X 10.4

Did anybody else notice this problem?


Mathias.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Exception raised when searching with sorting on an empty index.

Yonik Seeley-2
On 8/18/06, Mathias Herberts <[hidden email]> wrote:
> When doing a search with sorting on a field (ts) on the MultiSearcher
> with an empty RAM based index, an exception is thrown saying:
>
> no terms in field ts - cannot determine sort type

If you specify the type of sort you want, this shouldn't happen.
Letting Lucene guess the type (AUTO) shouldn't be done in a production
environment IMO.

Thinking about it though, I'm not sure why we need an exception thrown
in the case where there are no fields... that means all docs are equal
and we can simply select a string sort.

This made me thing of another failure mode for AUTO sorting (besides
guessing wrong or not having documents with that field)... a different
type could be guessed for different subsearchers.

-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]