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

Query syntax: Add support for spaces in field names #76

Closed
mikegoatly opened this issue Jul 5, 2023 · 6 comments
Closed

Query syntax: Add support for spaces in field names #76

mikegoatly opened this issue Jul 5, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mikegoatly
Copy link
Owner

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.

@mikegoatly mikegoatly added the enhancement New feature or request label Jul 5, 2023
@h0lg
Copy link

h0lg commented Jul 11, 2023

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.

@mikegoatly
Copy link
Owner Author

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.

@mikegoatly
Copy link
Owner Author

@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.

@mikegoatly
Copy link
Owner Author

I'm going to split wildcards out to #77 - they add significant complexity and implementing this feature without them add its own value.

mikegoatly added a commit that referenced this issue Aug 14, 2023
Breaking changes: [ and ] now special characters in query syntax
@mikegoatly mikegoatly added this to the v6 milestone Aug 17, 2023
@h0lg
Copy link

h0lg commented Aug 18, 2023

@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 Customers from your above example by [* Name]=Mike.

mikegoatly added a commit that referenced this issue Oct 29, 2023
Breaking changes: [ and ] now special characters in query syntax
@mikegoatly mikegoatly self-assigned this Oct 29, 2023
@mikegoatly mikegoatly mentioned this issue Dec 19, 2023
7 tasks
@mikegoatly
Copy link
Owner Author

This is completed and will be in the v6 release

mikegoatly added a commit that referenced this issue Jan 6, 2024
Breaking changes: [ and ] now special characters in query syntax
mikegoatly added a commit that referenced this issue Jan 16, 2024
Among other things...

* Use latest C# version
* Added support for bracketed field names #76
* Added field score boosting #72 (#83)
* Added field score boosting #72
* Added score boosting query syntax #72
* Add .NET 8 as a target
* Item score boosting (#95)
* Allow characters to be escaped in query syntax #85
* Removing ImmutableCollections (#97)
* Speed up field collection prior to scoring (#102)
* Added support for adding custom stemmers #82 (#103)
* Apply field filters while collecting results
* Filter documents at navigator level #105
* Added query part weight calculations #105
Refactor query match collection primitives
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants