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

fvh adaptor to highlight the top boost phrase only #799

Open
wants to merge 1 commit into
base: v0.x
Choose a base branch
from

Conversation

waziqi89
Copy link
Contributor

@waziqi89 waziqi89 commented Jan 2, 2025

RP-12281
Add top_boost_only toggle to highlight the found highest boosted phrase. This is achieved by adding an adaptor to the FragmentBuilder.

The test case is self-explanatory. Only the multiple occurances of the best match will be highlighted.

@waziqi89 waziqi89 requested a review from taoyyu January 2, 2025 21:58
@waziqi89
Copy link
Contributor Author

waziqi89 commented Jan 2, 2025

The <em>margarita pizza</em> and the <em>marinara pizza</em> in this pizzeria are yummy and inexpensive.

delicious: 4
margarita pizza: 3
marinara pizza: 3
yummy: 2 
  • if the top boost cannot be found, fallback to the next
  • tie matches are both highlighted
  • lower boosted matched aren't highlighted, but account for order

@waziqi89 waziqi89 changed the title fvh adaptor to highlight the top phrase once only. fvh adaptor to highlight the top boost phrase only Jan 9, 2025
@waziqi89 waziqi89 force-pushed the u/waziqi/RP-12281-hl branch from 26c0db4 to 575baa1 Compare January 9, 2025 16:36
@waziqi89 waziqi89 marked this pull request as ready for review January 9, 2025 16:38
@waziqi89 waziqi89 requested a review from sarthakn7 January 9, 2025 18:20
Comment on lines +66 to +71
fragInfo.getSubInfos().stream().map(SubInfo::getBoost).max(Float::compare).orElse(0f);
for (SubInfo subInfo : fragInfo.getSubInfos()) {
if (subInfo.getBoost() < topBoostValue) {
continue;
}
for (Toffs to : subInfo.getTermsOffsets()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those are the only added lines from the baseFragmentsBuilder's default method.

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.

1 participant