Skip to content
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

Call weight.getQuery().toString() once per query instead of once per leaf #524

Merged
merged 1 commit into from
Dec 2, 2022

Conversation

sarthakn7
Copy link
Contributor

@sarthakn7 sarthakn7 commented Dec 2, 2022

toString on a query object can be significantly expensive for large queries. Trying to avoid doing it multiple times for a single query. I also changed the order of the calls so the toString would not be called at all for CompletionQuery.

It would be better to avoid calling toString at all....but I couldn't find any test for which weight.getQuery().toString().contains("DrillSidewaysQuery") is true.

@sarthakn7 sarthakn7 requested a review from aprudhomme December 2, 2022 18:43
@sarthakn7 sarthakn7 marked this pull request as ready for review December 2, 2022 19:14
Copy link
Contributor

@aprudhomme aprudhomme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be helpful short term, but we should probably evaluate if this workaround is really needed anymore. I'm guessing this was from the original luceneserver code and may not apply to a newer lucene version or how we do faceting

@sarthakn7 sarthakn7 merged commit cb25af8 into master Dec 2, 2022
@sarthakn7 sarthakn7 deleted the sarthakn_query_toString branch December 2, 2022 20:13
@sarthakn7
Copy link
Contributor Author

@aprudhomme agreed. Would be good to confirm if we ever enter that branch other than for completion queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants