Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 5915 invoked from network); 7 Jun 2007 16:02:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jun 2007 16:02:52 -0000 Received: (qmail 63975 invoked by uid 500); 7 Jun 2007 16:02:52 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 63832 invoked by uid 500); 7 Jun 2007 16:02:51 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 63754 invoked by uid 99); 7 Jun 2007 16:02:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2007 09:02:51 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2007 09:02:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 21D8971417D for ; Thu, 7 Jun 2007 09:02:26 -0700 (PDT) Message-ID: <30949417.1181232146136.JavaMail.jira@brutus> Date: Thu, 7 Jun 2007 09:02:26 -0700 (PDT) From: "Ben Dotte (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist In-Reply-To: <15791055.1181209950455.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502398 ] Ben Dotte commented on LUCENE-916: ---------------------------------- I'm also having this problem. I'm trying to use Compass and originally reported the problem in their forum: http://forums.opensymphony.com/thread.jspa?threadID=87305&tstart=0 But I agree this seems more like a problem with Lucene itself. I have written a junit testcase that only uses Lucene objects that generates the same exception I was getting in Compass: public class CompassSortTest extends TestCase { public void testLuceneMultiSearcherSort() throws Exception { RAMDirectory dir1 = new RAMDirectory(); RAMDirectory dir2 = new RAMDirectory(); Analyzer analyzer = new StandardAnalyzer(); IndexWriter writer1 = new IndexWriter(dir1, analyzer, true); writer1.optimize(); writer1.close(); IndexWriter writer2 = new IndexWriter(dir2, analyzer, true); Document doc = new Document(); doc.add(new Field("displayName", "obj1", Store.YES, Index.TOKENIZED)); doc.add(new Field("id", "1", Store.YES, Index.UN_TOKENIZED)); doc.add(new Field("sortField", "3", Store.NO, Index.UN_TOKENIZED)); writer2.addDocument(doc); writer2.optimize(); writer2.close(); IndexSearcher searcher1 = new IndexSearcher(dir1); IndexSearcher searcher2 = new IndexSearcher(dir2); MultiSearcher multiSearcher = new MultiSearcher(new Searchable[] {searcher1, searcher2}); QueryParser parser = new QueryParser("displayName", analyzer); Query query = parser.parse("o*"); Sort sort = new Sort("sortField"); Hits hits = multiSearcher.search(query, sort); assertEquals("2", hits.doc(0).get("id")); assertEquals("3", hits.doc(1).get("id")); assertEquals("1", hits.doc(2).get("id")); } } The problem occurs when using a MultiSearcher that has at least one IndexSearcher tied to a Directory with no documents in it. If I have 2 IndexSearchers, each with 1 document the test passes. It is only when one of the IndexSearchers has no documents that the test fails. The exception I get is "no terms in field sortField - cannot determine sort type" on FieldCacheImpl.java line 331. > It is not possible to sort with sorttype auto on a field that does not exist > ---------------------------------------------------------------------------- > > Key: LUCENE-916 > URL: https://issues.apache.org/jira/browse/LUCENE-916 > Project: Lucene - Java > Issue Type: Bug > Components: Search > Affects Versions: 1.9, 2.0.0, 2.0.1, 2.1, 2.2 > Reporter: Daan de Wit > > When sorting with type auto on a field that does not exist, a RuntimeException is thrown from FieldCacheImpl.java line 346. This is especially a problem when using MultiSearcher. This issue is related to: http://issues.apache.org/jira/browse/LUCENE-374 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org