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

Search for search terms no further than *n* words apart #1648

Open
BeritJanssen opened this issue Aug 28, 2024 · 4 comments
Open

Search for search terms no further than *n* words apart #1648

BeritJanssen opened this issue Aug 28, 2024 · 4 comments
Labels
enhancement improvements to user functionality on hold

Comments

@BeritJanssen
Copy link
Member

Is your feature request related to a problem? Please describe.
This request came as a potential future request from the People & Parliament team: they would like to search for two search terms and make sure that they occur within close proximity to each other, not just anywhere in a document

Describe the solution you'd like
It seems the Elasticsearch intervals query might fit the bill. So I think the technical implementation should not be too much of an issue, but how to reflect this different type of query of the UI requires some consideration.

Describe alternatives you've considered
We might also post-process documents which are matches to the simple query string query - but I'm not sure that would be a better solution, as the UI question remains.

Additional context
Add any other context or screenshots about the feature request here.

@BeritJanssen BeritJanssen added enhancement improvements to user functionality on hold labels Aug 28, 2024
@jgonggrijp
Copy link
Member

jgonggrijp commented Sep 2, 2024

Does something like "firstterm secondterm"~5 OR "secondterm firstterm"~5 not already do what is asked?

@lukavdplas
Copy link
Contributor

OR is redundant (and would be | in simple query string syntax), but yes, that would work 👍

I was somewhat suprised because the query documentation on I-analyzer suggests that ~ for phrases has rather different semantics. It turns out that contradicts the elasticsearch manual.

That said, the query you formulate here isn't something I would expect a non-programmer to come up with. I would support making a more beginner-friendly option for this as part of #1436

@jgonggrijp
Copy link
Member

I think the query I suggested will match secondterm apple banana cherry date elderberry firstterm, while a simplified version without the OR and the second branch would not. Other than that, I agree those two queries would be equivalent.

@lukavdplas
Copy link
Contributor

Ah, to clarify: I meant you could leave out the disjunction operator, so "firstterm secondterm"~5 "secondterm firstterm"~5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements to user functionality on hold
Projects
None yet
Development

No branches or pull requests

3 participants