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

eval: prefer longer candidateMatch when removing overlaps #727

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

keegancsmith
Copy link
Member

When thinking about transforming queries like 'foo bar' into '(foo bar) or "foo bar"' we would want to keep the phrase candidateMatch and not throw it away in gatherMatches. By sorting longer matches before others that start at the same offset we end up keeping those.

Note: this only affects ChunkMatch, since for LineMatch we merge when we find overlaps.

Test Plan: This was quite hard to test with our existing e2e tests due to them not recording offsets, only matching lines. So instead I am just relying on the fact we didn't break anything and once we add proper support for phrases we will have a test then.

When thinking about transforming queries like 'foo bar' into '(foo bar)
or "foo bar"' we would want to keep the phrase candidateMatch and not
throw it away in gatherMatches. By sorting longer matches before others
that start at the same offset we end up keeping those.

Note: this only affects ChunkMatch, since for LineMatch we merge when we
find overlaps.

Test Plan: This was quite hard to test with our existing e2e tests due
to them not recording offsets, only matching lines. So instead I am just
relying on the fact we didn't break anything and once we add proper
support for phrases we will have a test then.
@keegancsmith
Copy link
Member Author

btw when manually testing I noticed that I might actually prefer what LineMatch does, it merges candidateMatch when there is overlap. This leads to the nice outcome of the full range being highlighted that matches. See the screenshot below. Some food for thought :)

image

@keegancsmith keegancsmith merged commit cdb1665 into main Jan 25, 2024
8 checks passed
@keegancsmith keegancsmith deleted the k/prefer-longer-candidates branch January 25, 2024 14:45
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