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

Fix highlighting and add support for storing and retrieving highlights #60

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

esmarkowski
Copy link
Member

This pull request fixes the issue with highlighting in the code and adds support for retrieving highlights.

CrashEvent.query_string("summary: propeller AND flight")
     .highlight(summary: {pre_tags: "__", post_tags: "__", fragment_size: 20})
     .first
     .highlights

All highlights are stored in .highlights

{"summary"=>[
    "While on a __flight__ originating",
    "inaugural westbound __flight__",
    "to feather the No. 2 __propeller__"
  ]
} 

Access highlights for an attribute with .highlights_for(:attribute_name)

CrashEvent.query_string("summary: propeller AND flight")
      .highlight(summary: {pre_tags: "__", post_tags: "__", fragment_size: 20})
      .first
      .highlights_for(:attribute_name)

"While on a flight originating ... inaugural westbound flight ... to feather the No. 2 propeller"

@esmarkowski esmarkowski self-assigned this Mar 11, 2024
@esmarkowski esmarkowski linked an issue Mar 11, 2024 that may be closed by this pull request
2 tasks
@esmarkowski esmarkowski merged commit abe9acb into main Mar 11, 2024
5 checks passed
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.

Highlighting
1 participant