You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Mathias Herberts <ma...@gmail.com> on 2006/08/18 23:52:06 UTC

Exception raised when searching with sorting on an empty index.

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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


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

Posted by Yonik Seeley <yo...@apache.org>.
On 8/18/06, Mathias Herberts <ma...@gmail.com> 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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org