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

Improve search results #78

Open
joepio opened this issue Oct 9, 2019 · 2 comments
Open

Improve search results #78

joepio opened this issue Oct 9, 2019 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@joepio
Copy link
Member

joepio commented Oct 9, 2019

I'm having a hard time improving the Elastic results. I use simple_query_string (#17) when the user has a special character to enable powerful search, and I use multi_match with phrase_prefix as a default.

{
  query: {
    bool: {
      must: [
        {
          multi_match: {
            fields: ["text", "title", "description", "name"],
            type: "phrase_prefix",
            operator: "OR",
            query: searchTerm,
          },
        },
      ],
    },
  },
}

The results are okay for on word queries, but when multiple words are used in one query, it doesn't seem to use the OR operator correctly, resulting in fewer hits for sentences, instead of more.

My reasoning for the above query:

  • Multi_match because I want to search across multiple fields.
  • phrase_prefix because I want to hit "watertekort" when I search for "water"
  • OR operator because it should use the OR operator between words.
  • The bool_prefix type seems reasonable, but we're running 7.0 and that doesn't support it.
@joepio joepio added the help wanted Extra attention is needed label Oct 9, 2019
@breyten
Copy link
Contributor

breyten commented Oct 9, 2019

You might want to try or instead of OR? ;-) (since apparently it is still using and)

Also boosting could also be used to improve search resuts, Ie title^4 to give more importance to matches in titles etc.

@joepio
Copy link
Member Author

joepio commented Oct 9, 2019

Thanks @breyten!

or vs OR give the same results. The problem had to do with phrase_prefix, and it disappeared when I switched to the best_fields type.

However, now the "water" "watertekort" auto complete prefix thingy doesn't work. Maybe something with N-grams / Compound words?

joepio added a commit that referenced this issue Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants