Query syntax: Add support for spaces in field names
mikegoatly opened this issue ยท 6 comments
At the moment fields can be registered statically or dynamically with spaces in them:
var index = new FullTextIndexBuilder<int>()
.WithObjectTokenization<Customer>(o => o
.WithId(c => c.CustomerId)
.WithField("Customer Name", c=>c.Name)
But there's no way using the LIFTI query syntax to filter on a field name with a space in it:
Customer Name=Something
The first part of the field name becomes part of the query.
We need to introduce something to quote a field name, e.g.
[Customer Name]=Something
We'd need to allow for edge cases where the field name contains a close bracket and it needs to be escaped.
It would also be be nice to match multiple fields against the same expression. Let's assume I want to match the same query against the UTF8 and the ASCII representation of a customer name:
var index = new FullTextIndexBuilder<int>()
.WithObjectTokenization<Customer>(o => o
.WithId(c => c.CustomerId)
.WithField("Customer Name", c => c.Name)
.WithField("Customer ASCII Name", c => c.AsciiName)
If possible, I'd like a query without repetition, e.g. [Customer Name|Customer ASCII Name]=Something
Or let's assume I want to search a group of dynamic fields sharing the same same prefix or suffix -
then I'd like to query those with [prefix*]=query
or [*suffix]=query
.
Obviously, this can be worked around by OR-combining the same query for different field names - so it may really just a be a convenience feature for people manually writing LIFTI queries.
Nice - I like the idea of being able to wildcard a field name in the query - with a dynamic field the exact names of all the fields might not be known.
@h0lg out of interest, what's your use-case for wanting a suffix wildcard match, e.g. [*suffix]=query
? I can understand the need for the prefix one to allow for searching across all dynamic fields with a given prefix, but I'm not sure about the suffix one.
I'm going to split wildcards out to #77 - they add significant complexity and implementing this feature without them add its own value.
@h0lg out of interest, what's your use-case for wanting a suffix wildcard match, e.g.
[*suffix]=query
? I can understand the need for the prefix one to allow for searching across all dynamic fields with a given prefix, but I'm not sure about the suffix one.
I could get the idea to group fields by a common name suffix instead of a common name prefix;
e.g. if I wanted to search Customer
s from your above example by [* Name]=Mike
.
This is completed and will be in the v6 release