lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] rclabo commented on issue #431: Query/Filter Casting
Date Thu, 29 Jul 2021 12:38:13 GMT

rclabo commented on issue #431:
URL: https://github.com/apache/lucenenet/issues/431#issuecomment-889089489


   I too think that having these return `Query` is probably fine.  Often a person won't need
to cast the result and will just work with it as query. In cases where the caller does need
to cast it, I'd rather cast it myself then deal with a generic day in and day out for these
methods since they add API complexity that often isn't needed.  Also, using a generic rather
than a cast, will still result in runtime casting errors if the generic type supplied isn't
correct.  So for example if I use a generic to specify to return type of  `TermQuery` when
the method call would otherwise return a `BooleanQuery` as a `Query` object it'll throw at
run time not compile time, no different then me doing a cast after the call.  
   
   In summary, most of the time I probably wouldn't need to cast these but if I needed to
I'd rather do the cast myself then use a generic to specify the return type so the method
can do the cast internally.  


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

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message