Re: Query Optimization in search/searchAfter

2024-04-12 Thread Puneeth Bikkumanla
Thanks Adrien! On Fri, Apr 12, 2024 at 9:49 AM Adrien Grand wrote: > You are correct, query rewriting is not affected by the use of search vs. > searchAfter. > > On Fri, Apr 12, 2024 at 3:37 PM Puneeth Bikkumanla > wrote: > > > Hello, > > Sorry I should have clarified what I meant by “optimized

Re: Query Optimization in search/searchAfter

2024-04-12 Thread Adrien Grand
You are correct, query rewriting is not affected by the use of search vs. searchAfter. On Fri, Apr 12, 2024 at 3:37 PM Puneeth Bikkumanla wrote: > Hello, > Sorry I should have clarified what I meant by “optimized”. I am familiar > with the collector/comparators using the “after” doc to filter ou

Re: Query Optimization in search/searchAfter

2024-04-12 Thread Puneeth Bikkumanla
Hello, Sorry I should have clarified what I meant by “optimized”. I am familiar with the collector/comparators using the “after” doc to filter out documents but I specifically was talking about the query rewriting phase. Is the query rewritten differently in search vs searchAfter? Looking at the co

Re: Query Optimization in search/searchAfter

2024-04-12 Thread Adrien Grand
Hello Puneeth, When you pass an `after` doc, Lucene will filter out documents that compare better than this `after` document if it can. See e.g. what LongComparator does with its `topValue`, which is the value of the `after` doc. On Thu, Apr 11, 2024 at 4:34 PM Puneeth Bikkumanla wrote: > Hello

Query Optimization in search/searchAfter

2024-04-11 Thread Puneeth Bikkumanla
Hello, I was wondering if a user-defined Query is optimized the same way in both search/searchAfter provided the index stays the same (no CRUD takes place). In searchAfter we pass in an "after" doc so I was wondering if that changes how a query is optimized at all. By looking at the code, I'm thin