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

Exact search in Sphinx #3301

Open
impulkit opened this issue Jan 3, 2017 · 4 comments · May be fixed by #12552
Open

Exact search in Sphinx #3301

impulkit opened this issue Jan 3, 2017 · 4 comments · May be fixed by #12552

Comments

@impulkit
Copy link

impulkit commented Jan 3, 2017

Subject:

Problem

  • I am trying to search for the string "show ipsec", but upon giving the string without quotes I get results which seem to be generated after searching for show and ipsec individually. Is there a way to get exact matches only?

Environment info

  • OS: Linux
  • Python version: 2.7
  • Sphinx version: 1.4.1
@tk0miya
Copy link
Member

tk0miya commented Jan 6, 2017

AFAIK, there are no way to do that.

@TimKam
Copy link
Member

TimKam commented Jan 22, 2017

Currently, the search index maps single words to .rst/html files.

For example, the search index "knows" that:

show occurs in file 1,2 and 5, whereas
ipsec occurs in file 1 and 2,

It knows little more.

If one wants to support exact searches for multiple-word strings, one needs to add the position of each word to the search index.

If this doesn't increase the index size too much, it might be practicable approach.

@tk0miya Do you think it is worth to look further into this?

@dlmurphy
Copy link

dlmurphy commented Oct 17, 2018

Dataverse uses Sphinx (version 1.5.6) for its documentation, and we're very interested in allowing our users to do this kind of exact phrase searching. It would make it much easier for our users to quickly find exactly the information they're looking for in our documentation. For the record, we're also interested in boolean search operators like AND, OR, and NOT, but this exact phrase searching is most important for us.

Here is our issue on the subject in our repo: IQSS/dataverse#4884

Here is an example of our use case:

One of our users searched for "terms of use" in quotations. This is what happens when you attempt this query in our current sphinx search:

43105328-79350ef0-8ea2-11e8-81be-b054930d4d2a

As you can see, this currently returns a useless list of all pages that use the words "use", "user", "used", etc. However, there are plenty of relevant sections about Terms of Use on our guides that are being drowned out. When I search "terms of use" using quotes on my local copy of the guides using SublimeText's search feature, I get these useful results:

43105408-c40d4e10-8ea2-11e8-8ead-b97bbd4f3b25

An exact phrase search would go a long way for cases like this.

@abulhol
Copy link

abulhol commented Feb 28, 2022

👍

@AA-Turner AA-Turner added this to the some future version milestone Sep 29, 2022
@AA-Turner AA-Turner linked a pull request Jul 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants