gsmiller commented on PR #12135:
URL: https://github.com/apache/lucene/pull/12135#issuecomment-1424699768

   Let me try to clarify a couple things:
   
   First, this is not an Elasticsearch use-case. Probably not all the 
important, but this is for an Amazon Product Search case, where we use Lucene 
directly. We're not applying access right, etc. We have use-cases where we need 
to evaluate allow-lists of products.
   
   Yes, we can fork all these queries. But this looks like an opportunity to 
avoid cloning and sorting an array multiple times. If both of these underlying 
queries need sorted terms, it seems like it would be nice to avoid it.
   
   Yes, a public constructor that requires sorted data should check it. The 
current proposal is doing this by leveraging the class type of the collection.
   
   I also agree with not exposing the prefix-encoded implementation detail in 
the constructor, which I've also addressed in the latest revision.
   
   It seems like the pushback here amounts to, 1) not wanting to mess with 
collections instead of arrays, and 2) generally feeling like this is an 
unnecessary complication for a non-general use-case. I personally disagree on 
both points. Sure, arrays are better in a number of ways, but this seems like a 
reasonable use of collections to "mark" sortedness as part of the type 
contract. While I also recognize that large cardinality term cases maybe aren't 
the "norm," we could extend that argument to say we shouldn't both with 
`TermInSetQuery` at all. BooleanQuery is just fine with few terms. I could 
create a slippery slope argument pretty quickly that says, "no more term in set 
at all!" I don't like what's at the bottom of that slope.
   
   So I disagree with the pushback (at least in the current revision; I fully 
understand the pushback around not exposing prefix encoding details). But I 
don't disagree so strongly that I'll keep fighting for this if folks are 
unhappy with it. I'll do one more pass to see if I can leverage `TimSort`'s 
efficient implementation on pre-sorted data. If that pans out, maybe it's 
enough to just sort the terms in `KeywordField` before passing them along. The 
underlying queries can still do their own sorting, which will just be a no-op. 
We'll still do some unnecessary array cloning, but maybe it doesn't matter.
   
   Anyway, I appreciate the feedback and the discussion!


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to