You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/04/02 16:29:22 UTC

[GitHub] [lucene-solr] msokolov commented on a change in pull request #631: LUCENE-8750: implement setMissingValue for ValueSource sortFields

msokolov commented on a change in pull request #631: LUCENE-8750: implement setMissingValue for ValueSource sortFields
URL: https://github.com/apache/lucene-solr/pull/631#discussion_r271392390
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java
 ##########
 @@ -428,6 +428,16 @@ public DoubleValuesSource rewrite(IndexSearcher searcher) throws IOException {
       this.producer = producer;
     }
 
+    @Override
+    public void setMissingValue(Object missingValue) {
+      if (missingValue instanceof Number && getType() == Type.CUSTOM) {
+        this.missingValue = missingValue;
 
 Review comment:
   hm, I forget why I thought I needed that check. I think you're right.  I'll just double-check and remove.
   
   > The setMissingValue() API is a bit nasty in general, isn't it? Perhaps we should revisit this and clean up type-safety etc in a separate issue.
   
   Yeah -- its ideas about type-safety are a little draconian. I didn't want to start making changes there just yet, but can follow up after.
   
   I also didn't particularly like having to setMissingValue both on the SortField, and internally on the ComparatorSource, but I'm not sure how to clean that up short of eliminating setMissingValue and moving the missingValue to getSortField() and the SortField constructors, which seems drastic. Or maybe the ComparatorSource should not be static and should read the missingValue from its enclosing ValuesSource?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org