Exact match on entire string
Opened this issue · 2 comments
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?
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.
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!).