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

Support hits to log count #789

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fragosoluana
Copy link
Member

This PR introduces a new feature in NRTSearch for HitsLoggerPlugin that allows for logging additional hits beyond what is returned to the client.

  • The system can now log more hits than are returned to the client, allowing the client to log a broader set of data without adding too much information in the search response.
  • Users can configure the number of hits to be returned separately from the number of hits to be logged.
  • Existing configurations will continue to function as before unless explicitly updated to use hitsToLog in LoggingHits message.

Testing

  • Unit tests have been added to verify the correct behavior of the response size reduction functionalities.
  • Added examples to demonstrate how to set up and utilize the new feature

Comment on lines +275 to +279
hits =
getHitsFromOffset(
hits,
searchContext.getStartHit(),
Math.max(searchContext.getTopHits(), searchContext.getHitsToLog()));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is exactly what you want here. How is hit logging expected to function when startHit is not 0? Note that topHits is applied before the startHit adjustment (unfortunately). If startHit=10, topHits=20, hitsToLog=10, would you expect to log the first 10 hits or the second 10 hits? For the latter, you would need to add startHit to hitsToLog before taking the max.

Comment on lines 71 to +74
int collectHits = request.getTopHits();
if (request.hasLoggingHits()) {
collectHits = request.getLoggingHits().getHitsToLog();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What if hitsToLog is less than topHits? This might be better as a max operation

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.

3 participants