You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Ryan McKinley (JIRA)" <ji...@apache.org> on 2010/09/27 00:09:33 UTC

[jira] Created: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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


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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921763#action_12921763 ] 

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

bq. This is not true, it returns DocTermCreator.DocTermsImpl and gives an ugly cast

DocTermCreator.DocTermsImpl (a private class only accessible within DocTermCreator) extends DocTerms and so it is true.

I won't argue about the ugly cast. :)

in #1023379 I changed DocTermsCreator and DocTermsIndexCreator to bind directly to the class (rather then T extends XXX)  This is a bit more clear, but does not let you extend the generic API (not that you need to)

> 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-caches.patch, 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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Yonik Seeley commented on LUCENE-2671:
--------------------------------------

Hopefully if/when this cache moves to IndexReader, we will still be able to cache arbitrary stuff on the reader?

> 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-caches.patch, 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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12917023#action_12917023 ] 

Uwe Schindler commented on LUCENE-2671:
---------------------------------------

Additionally, the source code formatting is not Lucene-conform (should be no newline before {, no extra space around method parameters).

> 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
>
>
> 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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921760#action_12921760 ] 

Robert Muir commented on LUCENE-2671:
-------------------------------------

bq. What part of the API is broken? 

DocTermsCreator

bq. The assumptions about what is in the Map are are internal to a private member that can not be touched outside this ugly class.

This is a public class.

It is parameterized as T extends DocTerms, but 
{noformat}
  @Override
  public T create(IndexReader reader) throws IOException {
{noformat}

This is not true, it returns DocTermCreator.DocTermsImpl and gives an ugly cast
{noformat}
    final T t =
      (T)new DocTermsImpl(bytes.freeze(true), docToOffset.getMutable());
    return t;
{noformat}

The api doesn't look extensible to me, I'm surprised it works. I guess this is why the compiler complains.

Granted i didnt take a lot of time to look it over, but the compiler warnings speak loudly enough in my favor.


> 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-caches.patch, 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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ 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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916009#action_12916009 ] 

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

Note, this solution does not (yet) address Uwe's concern about sorting NaN and real POSITIVE_INFINITY/NEGATIVE_INFINITY values.

I'm going to punt that to a different issues since it preexisted this one


> 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
>
>
> 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


[jira] Updated: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Ryan McKinley updated LUCENE-2671:
----------------------------------

    Attachment: LUCENE-2671-caches.patch

here is a new patch that applies cleanly.

I could go either way for -- keep it as it is, vs drop the first layer generic map

> 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-caches.patch, LUCENE-2671-caches.patch, 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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921759#action_12921759 ] 

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

bq. Hopefully if/when this cache moves to IndexReader, we will still be able to cache arbitrary stuff on the reader? 

Ya, the ReaderCache proposed in LUCENE-2665 simply uses the key from EntryCreator.getCacheKey().




> 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-caches.patch, 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


[jira] Updated: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Ryan McKinley updated LUCENE-2671:
----------------------------------

    Attachment: LUCENE-2671-caches.patch

This patch reduces the number of compiler warnings by removing a Map and replacing it with specific classes.  That is rather then:
{code:java}
private Map<Class<?>,Cache> caches;
{code}
we would have
{code:java}
  private Cache<ByteValues> byteCache;
  private Cache<ShortValues> shortCache;
  private Cache<IntValues> intCache;
  private Cache<FloatValues> floatCache;
  private Cache<LongValues> longCache;
  private Cache<DoubleValues> doubleCache;
  private Cache<DocTermsIndex> docTermsIndexCache;
  private Cache<DocTerms> docTermsCache;
  private final List<Cache<?>> caches = new ArrayList<Cache<?>>();
{code}

and then each type looks up its values directly:
{code:java}
  public IntValues getInts(IndexReader reader, String field, EntryCreator<IntValues> creator ) throws IOException {
    return intCache.get(reader, new Entry<IntValues>(field, creator));
  }
{code}

However, this approach still leaves one place that has class cast.  since the Cache holds a CreationPlaceholder while it is making the object, we can not use a simple generic Map.  Again, we could add some extra instanceof checks, but I don't think that adds anything



> 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-caches.patch, 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


[jira] Updated: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Ryan McKinley updated LUCENE-2671:
----------------------------------

    Attachment: LUCENE-2671-SortMissingLast.patch

This is the lucene only parts of SOLR-2134

> 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
>         Attachments: LUCENE-2671-SortMissingLast.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


[jira] Reopened: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Uwe Schindler reopened LUCENE-2671:
-----------------------------------


Hi Ryan,

this patch causes tons of unchecked warnings, without it, Lucene compiles without any.

The generics policeman does not understand this code so he cannot fix:

{noformat}
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:209: warning: [unchecked] unchecked cast
    [javac] found   : java.lang.Object
    [javac] required: T
    [javac]         key.creator.validate( (T)value, reader);
    [javac]                                  ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:278: warning: [unchecked] unchecked call to Entry(java.lang.String,org.apache.lucene.search.cache.EntryCreator<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Entry
    [javac]     return (ByteValues)caches.get(Byte.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                          ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:278: warning: [unchecked] unchecked call to get(org.apache.lucene.index.IndexReader,org.apache.lucene.search.FieldCacheImpl.Entry<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Cache
    [javac]     return (ByteValues)caches.get(Byte.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                 ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:293: warning: [unchecked] unchecked call to Entry(java.lang.String,org.apache.lucene.search.cache.EntryCreator<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Entry
    [javac]     return (ShortValues)caches.get(Short.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                            ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:293: warning: [unchecked] unchecked call to get(org.apache.lucene.index.IndexReader,org.apache.lucene.search.FieldCacheImpl.Entry<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Cache
    [javac]     return (ShortValues)caches.get(Short.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                   ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:308: warning: [unchecked] unchecked call to Entry(java.lang.String,org.apache.lucene.search.cache.EntryCreator<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Entry
    [javac]     return (IntValues)caches.get(Integer.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                            ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:308: warning: [unchecked] unchecked call to get(org.apache.lucene.index.IndexReader,org.apache.lucene.search.FieldCacheImpl.Entry<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Cache
    [javac]     return (IntValues)caches.get(Integer.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                   ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:323: warning: [unchecked] unchecked call to Entry(java.lang.String,org.apache.lucene.search.cache.EntryCreator<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Entry
    [javac]     return (FloatValues)caches.get(Float.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                            ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:323: warning: [unchecked] unchecked call to get(org.apache.lucene.index.IndexReader,org.apache.lucene.search.FieldCacheImpl.Entry<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Cache
    [javac]     return (FloatValues)caches.get(Float.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                   ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:337: warning: [unchecked] unchecked call to Entry(java.lang.String,org.apache.lucene.search.cache.EntryCreator<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Entry
    [javac]     return (LongValues)caches.get(Long.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                          ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:337: warning: [unchecked] unchecked call to get(org.apache.lucene.index.IndexReader,org.apache.lucene.search.FieldCacheImpl.Entry<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Cache
    [javac]     return (LongValues)caches.get(Long.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                 ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:352: warning: [unchecked] unchecked call to Entry(java.lang.String,org.apache.lucene.search.cache.EntryCreator<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Entry
    [javac]     return (DoubleValues)caches.get(Double.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                              ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:352: warning: [unchecked] unchecked call to get(org.apache.lucene.index.IndexReader,org.apache.lucene.search.FieldCacheImpl.Entry<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Cache
    [javac]     return (DoubleValues)caches.get(Double.TYPE).get(reader, new Entry(field, creator));
    [javac]                                                     ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:366: warning: [unchecked] unchecked call to Entry(java.lang.String,org.apache.lucene.search.cache.EntryCreator<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Entry
    [javac]     return (DocTermsIndex)caches.get(DocTermsIndex.class).get(reader, new Entry(field, creator));
    [javac]                                                                       ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:366: warning: [unchecked] unchecked call to get(org.apache.lucene.index.IndexReader,org.apache.lucene.search.FieldCacheImpl.Entry<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Cache
    [javac]     return (DocTermsIndex)caches.get(DocTermsIndex.class).get(reader, new Entry(field, creator));
    [javac]                                                              ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:382: warning: [unchecked] unchecked call to Entry(java.lang.String,org.apache.lucene.search.cache.EntryCreator<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Entry
    [javac]     return (DocTerms)caches.get(DocTerms.class).get(reader, new Entry(field, creator));
    [javac]                                                             ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\FieldCacheImpl.java:382: warning: [unchecked] unchecked call to get(org.apache.lucene.index.IndexReader,org.apache.lucene.search.FieldCacheImpl.Entry<T>) as a member of the raw type org.apache.lucene.search.FieldCacheImpl.Cache
    [javac]     return (DocTerms)caches.get(DocTerms.class).get(reader, new Entry(field, creator));
    [javac]                                                    ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\cache\DocTermsCreator.java:137: warning: [unchecked] unchecked cast
    [javac] found   : org.apache.lucene.search.cache.DocTermsCreator.DocTermsImpl
    [javac] required: T
    [javac]     return (T)new DocTermsImpl(bytes.freeze(true), docToOffset.getMutable());
    [javac]               ^
    [javac] C:\Users\Uwe Schindler\Projects\lucene\trunk-solr\lucene\src\java\org\apache\lucene\search\cache\DocTermsIndexCreator.java:169: warning: [unchecked] unchecked cast
    [javac] found   : org.apache.lucene.search.cache.DocTermsIndexCreator.DocTermsIndexImpl
    [javac] required: T
    [javac]     return (T)new DocTermsIndexImpl(bytes.freeze(true), termOrdToBytesOffset.getMutable(), docToTermOrd.getMutable(), termOrd);
    [javac]               ^
{noformat}

> 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
>
>
> 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


[jira] Issue Comment Edited: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Yonik Seeley edited comment on LUCENE-2671 at 9/26/10 8:27 PM:
---------------------------------------------------------------

Ah - I was just about to report "hmmm, doesn't seem to be working".  But then I realized you separated them out and this is the lucene part only.

IMO - if you're working on these together (and esp if the original motivation was to ultimately get the functionallity into Solr, it's simpler to keep it as a single issue / single patch).

edit: and two patches are tougher to deal with - in fact, I can't apply the solr one either with or without this patch... not sure what's up.

      was (Author: yseeley@gmail.com):
    Ah - I was just about to report "hmmm, doesn't seem to be working".  But then I realized you separated them out and this is the lucene part only.

IMO - if you're working on these together (and esp if the original motivation was to ultimately get the functionallity into Solr, it's simpler to keep it as a single issue / single patch).
  
> 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
>         Attachments: LUCENE-2671-SortMissingLast.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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921686#action_12921686 ] 

Robert Muir commented on LUCENE-2671:
-------------------------------------

I am concerned about the @SuppressWarnings here, for two reasons:

# I don't think we should use this except in limited circumstances where its not our fault (see below)
# I don't think we should leave the API broken pending some massive "rework fieldcache" issue, which it appears has been attempted before...
# I don't understand the generics in the current API at all

In general with SuppressWarnings, i think we should limit our uses to cases where its really a false warning
* generic collections/array problems
* documenting intentional fallthroughs in switch statements
* possibly autogenerated code from something else like javacc/jflex

I'd like for us to remove the SuppressWarnings and look at what we can do to fix the API right now as-is.

> 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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921768#action_12921768 ] 

Robert Muir commented on LUCENE-2671:
-------------------------------------

{quote}
in #1023379 I changed DocTermsCreator and DocTermsIndexCreator to bind directly to the class (rather then T extends XXX) This is a bit more clear, but does not let you extend the generic API (not that you need to)
{quote}

thanks Ryan!

> 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-caches.patch, 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


[jira] Commented: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Yonik Seeley commented on LUCENE-2671:
--------------------------------------

Ah - I was just about to report "hmmm, doesn't seem to be working".  But then I realized you separated them out and this is the lucene part only.

IMO - if you're working on these together (and esp if the original motivation was to ultimately get the functionallity into Solr, it's simpler to keep it as a single issue / single patch).

> 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
>         Attachments: LUCENE-2671-SortMissingLast.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


[jira] Resolved: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Ryan McKinley resolved LUCENE-2671.
-----------------------------------

    Fix Version/s: 4.0
       Resolution: Fixed

added in #1002460 -- this can be backported to 3.x when LUCENE-2665 is stabalized

> 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
>
>
> 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


[jira] Updated: (LUCENE-2671) Add sort missing first/last ability to SortField and ValueComparator

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

Ryan McKinley updated LUCENE-2671:
----------------------------------

    Attachment: LUCENE-2671-suppress-unchecked.patch

here is a patch that ignores all the unchecked casts
{code:java}
 @SuppressWarnings("unchecked")
{code}

I don't think there is any way around this for the current design -- in LUCENE-2665, the cache would directly use the generic map, but for the baby step it needs a cast.

The issues is that we have:
{code:java}
private Map<Class<?>,Cache> caches;
{code}

and really need to be able to define something like:
{code:java}
private Map<Class<X>,Cache<? extends X>> caches;
{code}
where X depends on what you put into the map...  but that is not possible as far as I know.

- - -

I would commit this, but the build is failing for other reasons....  



> 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