shubhamvishu commented on PR #12427: URL: https://github.com/apache/lucene/pull/12427#issuecomment-1630241517
@gsmiller I totally agree its not helpful if the input/data `Collection` is sorted since its a unnecessary overhead to convert to a `List` here. As per `TermInSetQuery` ctor its checking if the `collection` is of `SortedSet` type and uses natural ordering. But what if the user is explicitly passing a List (or any `Collection` for that matter) which is already sorted but is not `SortedSet`? Could we expose another `#build` function as `build(Collection<BytesRef> input, boolean asBinary, boolean isSorted)` or for better maybe `makeStringUnion(Collection<BytesRef> utf8Strings, boolean isSorted)` (similar to the one in tests in this PR) to completely bypass the sorting/checks if incase `isSorted == true` else we could have the same check as in `TermInSetquery` ctor and sort the terms incase they are not before moving on in `Automata#makeStringUnion` as you mentioned? Let me know your thoughts? -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org