Skip to content

Search optimisations#240

Merged
rosemcc merged 5 commits into
masterfrom
search-optimise
Mar 7, 2022
Merged

Search optimisations#240
rosemcc merged 5 commits into
masterfrom
search-optimise

Conversation

@rosemcc
Copy link
Copy Markdown
Contributor

@rosemcc rosemcc commented Feb 28, 2022

Description

This PR provides a couple of optimisations for search:

  1. Boosting titles - if a search query is found in the title of an entry, then that result's score is boosted x2
  2. Phrase queries (where a user is looking for an exact phrase by using quotation marks around the query) are fixed

Solution

  1. Boosting titles: added a function which wraps around the existing Elasticsearch query which takes the output of the query, then applies a function to increase the weighting of results that contain the search query in the title field. Results with matches in the title will now show further up the list of search results.
  2. Phrase queries: Fixed a bug where phrase queries (and other query operators) and fuzziness operators were interfering with each other. Now, if a search query contains any of these operators: '+', '|', '-', '*', '"', '(', ')', the fuzziness operator will not be used which will improve the search results.

Screenshots

N/A

Testing

No new tests have been added

Have the changes been checked in the following browsers?

N/A

@rosemcc rosemcc requested review from Trombach and devslashnoel March 3, 2022 20:58
Copy link
Copy Markdown
Contributor

@Trombach Trombach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Only one suggestions. But that code seems to have been there for ever so it might as well stay. Your call!

Comment thread hub-search-proxy/handler.js Outdated
@rosemcc rosemcc merged commit c55e25a into master Mar 7, 2022
@rosemcc rosemcc deleted the search-optimise branch March 7, 2022 02:52
@rosemcc rosemcc mentioned this pull request Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants