[ 
https://issues.apache.org/jira/browse/LUCENE-2941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Muir updated LUCENE-2941:
--------------------------------

    Attachment: LUCENE-2941_test.patch

attached is a testcase (fails on both trunk and 3.x):

this works:   
{noformat}
public void testSort() throws Exception {
    SortField sf = new SortField("field", locale);
    TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), null, numDocs, 
new Sort(sf));
...
{noformat}

this doesn't, if IS uses executorservice:
{noformat}
  public void testSort2() throws Exception {
    SortField sf = new SortField("field", new FieldComparatorSource() {
      @Override
      public FieldComparator newComparator(String fieldname, int numHits, int 
sortPos, boolean reversed) throws IOException {
        return new FieldComparator.StringComparatorLocale(numHits, fieldname, 
locale);
      }
    });
    TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), null, numDocs, 
new Sort(sf));
{noformat}

The problem is inside the FieldDocSortedHitQueue... the only reason Locale sort 
works today is because it cheats and looks inside the SortField to see if it 
has a locale, and does things with its collator.

But if you code the same approach as a custom sort, it won't work.


> custom sort broken if IS uses executorservice
> ---------------------------------------------
>
>                 Key: LUCENE-2941
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2941
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>             Fix For: 3.1
>
>         Attachments: LUCENE-2941_test.patch
>
>


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to