New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new static method for KeywordField#newSetQuery to support collections parameter #12243
Comments
"flexibility" is usually a dirty word when it comes to apis, is there a better explanation of the use-case? Especially given that Collection has .toArray already, it seems really easy for the user to use as-is? |
and frankly, i have big concerns that this method will somehow warp into something other than calling .toArray to help the user. database users be database users and this kind of complexity has crept in here before. Let's keep it simple with basic arrays. |
Thanks for the quick reply @rmuir , I'll try explain the use case better. Calling the existing So in the case of having a List of BytesRef, we would first call The new |
It is sort of odd to take an ordered collection ( Or does |
I don't think the fact that TermInSetQuery has a Collection ctor should impact this at all. Maybe that should be removed? |
+1 It's weird to take both array and Collection when the API is just going to do the obvious conversion that a caller would do? We should somehow be consistent here about such "sugar" APIs. But if we are going to pick one, shouldn't it be I don't feel strongly though (Collection vs array) ... but I do agree we should be consistent. |
Thanks Mike, to progress the discussion I opened a PR to remove the |
Description
Currently, the KeywordField class provides a public static method
newSetQuery(String field, BytesRef... values)
. However, this method only supports varargs parameter for values. I would like to propose adding a new static method that allows for a collections parameter for values, as this would provide greater flexibility.Proposed method signature:
public static Query newSetQuery(String field, Collection<BytesRef> values)
I am willing to make the changes and submit a pull request.
Please let me know if there are any concerns or feedback. Thank you!
The text was updated successfully, but these errors were encountered: