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

Fuzzy field-based search with multiple terms #85

Closed
fliepeltje opened this issue Feb 11, 2022 · 2 comments
Closed

Fuzzy field-based search with multiple terms #85

fliepeltje opened this issue Feb 11, 2022 · 2 comments
Labels
0.10.0 Planned for the 0.10 milestone enhancement New feature or request

Comments

@fliepeltje
Copy link

Reading through the docs and the source code it seems like you can specify which fields you can search a specific term for, so you can issue a query like:

{
    "query": [
         {"term": {"ctx": "Harry Potter", "fields": ["role"]}, "occur": "must"},
         {"term": {"ctx": "Daniel Radcliffe", "fields": ["actor"]}, "occur": "must"}
     ]
}

It would be really neat if it were possible to do the same for fuzzy queries so that something like this would be possible:

{
   "query": [
        {"fuzzy": {"ctx": "Barry Potter", "fields": ["role"]}, "occur": "must"},
        {"fuzzy": {"ctx": "Daniel Radclif", "fields": ["actor"]}, "occur": "must"}
    ]
}

To put this in a little more perspective in terms of a use case, suppose documents of movies, actors, and roles. I might have heard that the lead character of a movie is called Harry Potter but have no idea what movie this character belongs in, but I do want to know who the actor is.

If I were to create an index with the fuzzy method, I could create an index across all 3 fields, but when I search for Harry Potter I will get a bunch of results of actors on account of the movie being called Harry potter and the ...

Alternatively I could create separate indexes for each of these and search the individual index, but then I run into the problem that once I do have more information (like say movie name or actor name), I would have to compute a likelihood score myself from results of searching multiple indexes.

@ChillFish8 ChillFish8 added the enhancement New feature or request label Feb 11, 2022
@ChillFish8
Copy link
Collaborator

This is a good idea, I'll probably mark this as something to target for 0.10 as I want to stabilize stuff for the 0.9 release.

I plan on making the query system a bit more configurable and more intuitive but right now the current query system makes it a little bit limiting to do without creating a mess in the code base.

@ChillFish8 ChillFish8 added the 0.10.0 Planned for the 0.10 milestone label Feb 11, 2022
@ChillFish8 ChillFish8 added this to the Version 0.10.0 milestone Feb 11, 2022
@ChillFish8
Copy link
Collaborator

I forgot to close this when merging the PR, but this has been added to master now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.10.0 Planned for the 0.10 milestone enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants