lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan McKinley (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator
Date Sat, 16 Oct 2010 18:16:22 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921725#action_12921725
] 

Ryan McKinley commented on LUCENE-2671:
---------------------------------------


bq. I don't think we should leave the API broken pending some massive "rework fieldcache"
issue, which it appears has been attempted before...

What part of the API is broken?  The assumptions about what is in the Map are are internal
to a private member that can not be touched outside this ugly class.  My reference to 


To avoid the compiler warning, we could do something like:
{code:java}
  public DoubleValues getDoubles(IndexReader reader, String field, EntryCreator<DoubleValues>
creator ) throws IOException {
    Object v = caches.get(Double.TYPE).get(reader, new Entry(field, creator));
    if( v instanceof DoubleValues ) {
      return (DoubleValues)v;
    }
    throw new RuntimeException( "should be of type DoubleValues rather then: "+v.getClass()
);
  }
{code}
But this is more complex and equivalent to the ClassCastException that would be thrown with
the original code.

Another option is to drop the caches Map<Class,Cache> since that is where we lose what
type the output should be.  I will post a patch with this option

> Add sort missing first/last ability to SortField and ValueComparator
> --------------------------------------------------------------------
>
>                 Key: LUCENE-2671
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2671
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Search
>            Reporter: Ryan McKinley
>            Assignee: Ryan McKinley
>             Fix For: 4.0
>
>         Attachments: LUCENE-2671-SortMissingLast.patch, LUCENE-2671-suppress-unchecked.patch
>
>
> When SortField and ValueComparator use EntryCreators (from LUCENE-2649) they use a special
sort value when the field is missing.
> This enables lucene to implement 'sort missing last' or 'sort missing first' for numeric
values from the FieldCache.

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


Mime
View raw message