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 regex to identify matches in content search response #566

Merged
merged 7 commits into from
Jul 16, 2024
Merged

Conversation

Dananji
Copy link
Collaborator

@Dananji Dananji commented Jul 11, 2024

Related issue: #564

@Dananji Dananji marked this pull request as draft July 11, 2024 21:26
@Dananji Dananji marked this pull request as ready for review July 15, 2024 21:05
@Dananji Dananji marked this pull request as draft July 16, 2024 14:38
@Dananji Dananji marked this pull request as ready for review July 16, 2024 14:38
Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

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

I tried testing this locally by converting the Gatsby test data into a VTT (attached as Gatsby.vtt.txt since I had to change the extension to get github to attach it), loading that into Avalon, then testing within ramp. Searching worked as expected for all of the test cases in this PR, but I found a couple issues:

  • Searching 'invited' only shows one result in ramp when the content search is returning two (the second being 'invited-they')
  • Searching 'dr eckleburg who' or 'went there they' will match correctly but remove the remainder of the cue text

It seems like Ramp is trying really hard to mimic the behavior of Avalon's content search and is doing a pretty good job at it, but I'm afraid of Ramp having to keep up with changes if Avalon changes how it's content search works. I'm wondering if instead of trying to match exactly like how the content search matches Ramp tries to replace the match text entirely with what comes back from the content search and then adjusts the match tags as it sees fit. This approach relies more on the content search which will probably have it's own issues.

If the two issues I saw can be easily fixed then I think this implementation might be good enough for now. If we run into too many edge cases then we may want to consider trying the replacement approach, but I'm hoping that can wait until after Avalon 7.8.

src/services/transcript-parser.js Outdated Show resolved Hide resolved
Co-authored-by: Chris Colvard <chris.colvard@gmail.com>
Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

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

I retested and the two issues are resolved for me! 🎉
I am seeing console logging when a query has a single character after a space. It is still matching and highlighting when there is a valid match like "night I" so I'm not sure if this is really a problem or not.

Error building RegExp for query:  night i
Error building RegExp for query:  who h
Error building RegExp for query:  automobiles w
Error building RegExp for query:  automobiles which b

@Dananji
Copy link
Collaborator Author

Dananji commented Jul 16, 2024

These console logs are related to the error I mentioned where, the function building the regular expression bombing when it is called with intermediate queries.

This doesn't impact search within functionality as far as I know. It is just the handling of intermediate states of the search query when it is typed in.

@Dananji Dananji merged commit 94c8c17 into main Jul 16, 2024
2 checks passed
@Dananji Dananji deleted the search-regex branch July 16, 2024 18:34
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