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

Exact match on entire string #122

Open
PetesBreenCoding opened this issue Sep 2, 2024 · 2 comments
Open

Exact match on entire string #122

PetesBreenCoding opened this issue Sep 2, 2024 · 2 comments

Comments

@PetesBreenCoding
Copy link

This is more of a question than an issue. Is it possible to search by an exact match of the whole field value?

e.g. if I had something like this:
.Search("Brand=Skoda&Description=Test")

How can I word the Brand=Skoda part to make it match exactly the entire string in the Brand field, rather than just contained within it?

@mikegoatly
Copy link
Owner

That's a great question - I don't think there's an easy way to do that at the moment.

The only hack that springs to mind is to add some fake markers to the field's text, e.g. ¬¬ Skoda ¬¬ that way you can use the a sequential text query, adding the markers to either end ("¬¬ Skoda ¬¬") which will enforce that the text matches the whole string.

To properly handle this in the query language we'd need some additional syntax to match the start and end of a string (similar to the ^ and $ you can use in a regex?). We store token indexes in the index, so knowing the start will be easy; it would be token index 0, but we'd need to store some additional metadata in the index because there won't be an obvious way to identify whether a current match is the last parsed token.

@PetesBreenCoding
Copy link
Author

Thanks Mike, I will work with the begin/end tags workaround for now. Adding query syntax would make sense, unfortunately the ^ is already used for score boost. I guess score boost could be changed to something else (breaking change!).

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

No branches or pull requests

2 participants