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

Adding HumanReadableQuery with a descrition param, used for debugging print output #12816

Merged
merged 10 commits into from
Nov 18, 2023

Conversation

slow-J
Copy link
Contributor

@slow-J slow-J commented Nov 16, 2023

We use this only in KnnByte/FloatVectorQuery toString method so the benchmarker can disambiguate between different KnnFloatVectorQuery/KnnByteVectorQuery queries.

Closes #12487 and should enable VectorQuery fixes to the benchmarker in mikemccand/luceneutil#226. More details about the problem in the issues.

We use this only in KnnByte/FloatVectorQuery toString method so the benchmarker can disambiguate between different KnnFloatVectorQuery/KnnByteVectorQuery queries.
@jpountz
Copy link
Contributor

jpountz commented Nov 16, 2023

I'd rather like not to touch these queries, and introduce a brand new query that rewrites to a Knn(Byte|Float)VectorQuery and may add a description string. Something like HumanReadableQuery(Query in, String description) that would always rewrite to its inner query?

@benwtrent
Copy link
Member

I much prefer @jpountz idea. This additional field is purely for debugging purposes. A DebugQuery or HumanReadableQuery does seem like a good idea.

@slow-J
Copy link
Contributor Author

slow-J commented Nov 16, 2023

Thanks for the suggestion @jpountz! I'll add a HumanReadableQuery and revert the current changes. I think it would be quite similar to the AssertingQuery.

@slow-J slow-J changed the title Adding optional queryDescription String to AbstractKnnVectorQuery Adding HumanReadableQuery with a descrition param, used for debugging print output Nov 16, 2023
@slow-J
Copy link
Contributor Author

slow-J commented Nov 16, 2023

Created a HumanReadableQuery which wraps a Query and only changes the .toString() behaviour, please let me know if I misunderstood any part of the suggestion.

@Override
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
throws IOException {
return in.createWeight(searcher, scoreMode, boost);
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if a bonus here would be a wrapped weight that overrides explain and adds the human description to the output?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or we keep it as simple as possible, return the inner query in #rewrite and throw an UnsupportedOperationException in #createWeight?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make it as simple as possible for now, and if needed we can always extend it further.

@jpountz
Copy link
Contributor

jpountz commented Nov 16, 2023

Should we move it in lucene/misc rather than lucene/core?

@slow-J
Copy link
Contributor Author

slow-J commented Nov 16, 2023

Should we move it in lucene/misc rather than lucene/core?

Yes, that sounds like a better place for it.

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

I left minor comments but it looks good to me otherwise!

slow-J and others added 2 commits November 18, 2023 02:48
@slow-J
Copy link
Contributor Author

slow-J commented Nov 18, 2023

I left minor comments but it looks good to me otherwise!

Thanks for the feedback! Done the changes there.

@jpountz jpountz merged commit b3ef869 into apache:main Nov 18, 2023
4 checks passed
jpountz pushed a commit that referenced this pull request Nov 18, 2023
mikemccand added a commit that referenced this pull request Nov 20, 2023
…0.0 -> 9.9.0 on bulk backport of recent FST improvements
slow-J added a commit to slow-J/lucene that referenced this pull request Nov 20, 2023
slow-J pushed a commit to slow-J/lucene that referenced this pull request Nov 20, 2023
… move CHANGES.txt entry from 10.0 -> 9.9.0 on bulk backport of recent FST improvements
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.

Can/should KnnByte/FloatVectorQuery carry some human-meaningful opaque toString fragment?
3 participants