[
https://issues.apache.org/jira/browse/SOLR-2134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915089#action_12915089
]
Ryan McKinley commented on SOLR-2134:
-------------------------------------
this is the Tri* getSortField code:
{code:java}
public SortField getSortField(SchemaField field, boolean top) {
int flags = CachedArrayCreator.CACHE_VALUES_AND_BITS;
Object missingValue = null;
boolean sortMissingLast = on( SORT_MISSING_LAST, properties );
boolean sortMissingFirst = on( SORT_MISSING_FIRST, properties );
switch (type) {
case INTEGER:
if( sortMissingLast ) {
missingValue = Integer.MAX_VALUE;
}
else if( sortMissingFirst ) {
missingValue = Integer.MIN_VALUE;
}
return new SortField( new IntValuesCreator( field.getName(),
FieldCache.NUMERIC_UTILS_INT_PARSER, flags ), top).setMissingValue(
missingValue );
case FLOAT:
if( sortMissingLast ) {
missingValue = Float.MAX_VALUE;
}
else if( sortMissingFirst ) {
missingValue = Float.MIN_VALUE;
}
return new SortField( new FloatValuesCreator( field.getName(),
FieldCache.NUMERIC_UTILS_FLOAT_PARSER, flags ),
top).setMissingValue( missingValue );
case DATE: // fallthrough
case LONG:
if( sortMissingLast ) {
missingValue = Long.MAX_VALUE;
}
else if( sortMissingFirst ) {
missingValue = Long.MIN_VALUE;
}
return new SortField( new LongValuesCreator( field.getName(),
FieldCache.NUMERIC_UTILS_LONG_PARSER, flags ),
top).setMissingValue( missingValue );
case DOUBLE:
if( sortMissingLast ) {
missingValue = Double.MAX_VALUE;
}
else if( sortMissingFirst ) {
missingValue = Double.MIN_VALUE;
}
return new SortField( new DoubleValuesCreator( field.getName(),
FieldCache.NUMERIC_UTILS_DOUBLE_PARSER, flags ),
top).setMissingValue( missingValue );
default:
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown
type for trie field: " + field.name);
}
}
{code}
> Trie* fields should support sortMissingLast=true, and deprecate Sortable*
> Field Types
> -------------------------------------------------------------------------------------
>
> Key: SOLR-2134
> URL: https://issues.apache.org/jira/browse/SOLR-2134
> Project: Solr
> Issue Type: Improvement
> Components: Schema and Analysis
> Reporter: Ryan McKinley
> Attachments: SOLR-2134-SortMissingLast.patch,
> SOLR-2134-SortMissingLast.patch
>
>
> With the changes in LUCENE-2649, the FieldCache also returns if the bit is
> valid or not. This is enough to support sortMissingLast=true with Trie*
> fields. Then we can get rid of the Sortable* fields
--
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: [email protected]
For additional commands, e-mail: [email protected]