You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Daan de Wit (JIRA)" <ji...@apache.org> on 2007/06/07 11:52:30 UTC

[jira] Created: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

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: 2.1, 2.0.0, 1.9, 2.0.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


[jira] Commented: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502425 ] 

Yonik Seeley commented on LUCENE-916:
-------------------------------------

> if Lucene is going to support automatic sorting, I think it should be supported regardless of whether an individual IndexSearcher is being used vs. a MultiSearcher.

I agree.  Perhaps picking *any* type in the AUTO sorting code would work since it won't yield any hits.

> 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
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Updated: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Daan de Wit (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daan de Wit updated LUCENE-916:
-------------------------------

    Attachment: TestMultiSearcherAutoSort.java

Attached a test case to reproduce this issue (Ben Dotta's test slightly modified)

> 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
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Commented: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Ben Dotte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502416 ] 

Ben Dotte commented on LUCENE-916:
----------------------------------

We're in the same boat as Daan, our searching/sorting code is also abstracted away and does not know the types. But we could also include the types without much difficulty.. based on Yonik's statement and the recommendation by Compass, I would say that is probably the best route for us.

On the other hand, if Lucene is going to support automatic sorting, I think it should be supported regardless of whether an individual IndexSearcher is being used vs. a MultiSearcher.

> 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
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Commented: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Ben Dotte (JIRA)" <ji...@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


[jira] Commented: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502426 ] 

Yonik Seeley commented on LUCENE-916:
-------------------------------------

> Perhaps picking *any* type in the AUTO sorting code would work since it won't yield any hits.

Oops, that's not true since there could be plenty of hits in an index, but none of them may have that particular field indexed.

> 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
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Resolved: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-916.
---------------------------------------

    Resolution: Won't Fix

We're removing SortField.AUTO in 3.0.

> 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.1, 2.2
>            Reporter: Daan de Wit
>            Assignee: Mark Miller
>             Fix For: 2.9
>
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Updated: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-916:
--------------------------------------

    Fix Version/s: 2.9

> 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.1, 2.2
>            Reporter: Daan de Wit
>            Assignee: Mark Miller
>             Fix For: 2.9
>
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Commented: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Daan de Wit (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502411 ] 

Daan de Wit commented on LUCENE-916:
------------------------------------

We have several sortable overviews in our application in which the user can search, these overviews are backed by Compass and the code that implements the sorting and searching is pretty much abstracted. I can avoid using auto sort, but then I have to carry around the sort type of each column, that's something I wanted to avoid. I already need to carry the field name corresponding to each column so it's not that big of a deal, but it just doesn't feel right to me.

> 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
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Assigned: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Miller reassigned LUCENE-916:
----------------------------------

    Assignee: Mark Miller

> 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.1, 2.2
>            Reporter: Daan de Wit
>            Assignee: Mark Miller
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Commented: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660595#action_12660595 ] 

Mark Miller commented on LUCENE-916:
------------------------------------

I think I can probably come up a solution to this after LUCENE-1483 goes in. I've run into it myself, and its annoying.

> 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.1, 2.2
>            Reporter: Daan de Wit
>            Assignee: Mark Miller
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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


[jira] Commented: (LUCENE-916) It is not possible to sort with sorttype auto on a field that does not exist

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502403 ] 

Yonik Seeley commented on LUCENE-916:
-------------------------------------

IMO, auto sorting should pretty much never be used.
Applications should know the types of their fields, and should not let Lucene guess (it will sometimes guess incorrectly).


> 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
>         Attachments: TestMultiSearcherAutoSort.java
>
>
> 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