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

Root-198: add search-as-you-type suggestion query functionality #7

Merged
merged 16 commits into from
Mar 13, 2019

Conversation

jesconstantine
Copy link

@jesconstantine jesconstantine commented Feb 25, 2019

This PR adds the following functionality:

  • the solr client can now handle an event that should trigger a "suggest" query and dispatches an action with the necessary payload, based on autocomplete configuration (which comes from the implementing app)
  • two new reducers will handle setting the state of the "suggest" query (which pulls some values from the regular search query for things like credentials, filters, facets) and setting the state of the suggestion results
  • two new functions will handle building the "suggest" query
  • the "server" will perform a new xhr request for making the "suggest" query and dispatch the appropriate action and payload to on of the new reducers
  • this new functionality has added test coverage

This PR also makes the solr client un-opinionated about default / query fields, relying on the implementation's solr config to set these. This allows flexibility with the default search, autocomplete, and enables field boosting to be set in solr config.

Main and autocomplete queries are now sent with q=<mainQueryField.value> as opposed to q=tm_rendered_item:<mainQueryField.value> and q=<mainQueryField.value>+<mainQueryField.value>*&df=mainQueryField.field respectively.

To test

  1. See corresponding PR in the app repo which has updated its package.json to pull from this branch and follow that PR's test steps for functional test
  2. Run tests in this repo by pulling down this branch and running yarn test, observe that all tests pass
  3. See the test output for buildSuggestQuery, solrSuggestQuery, suggestQueryReducer, suggestionsReducer for a high level understanding of what the new code does (as of now, this will likely change a bit this week)

TODO

  1. Alter the suggest query to either a) accept configuration for choosing a query parser + query fields or b) only send the search term and rely on solr config to handle everything else

@jesconstantine
Copy link
Author

jesconstantine commented Mar 13, 2019

Tested heavily by @agentrickard in PRs referenced above. Merging!

@jesconstantine jesconstantine merged commit 18f3092 into master Mar 13, 2019
@jesconstantine jesconstantine deleted the root-138-autocomplete branch March 13, 2019 16:39
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.

1 participant