ROOT-198: remove default field from queries, make autocomplete wildcard* configurable #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements latest updates to palantirnet/solr-faceted-search-react#7 which makes the search app un-opinionated about main + autocomplete query default / query fields. This allows flexibility with the default search, autocomplete, and enables field boosting to be set in solr config.
Queries now have the following structure:
q=<mainQueryField.value>
as opposed toq=tm_rendered_item:<mainQueryField.value>
autocomplete.appendWildcard
is true:q=<mainQueryField.value>+<mainQueryField.value>*&df=mainQueryField.field
autocomplete.appendWildcard
is false (default):q=<mainQueryField.value>
See the updates to the solr client repo tests for more details.
To accommodate these updates, this PR also updates the autocomplete config in the example config file.
To Test
Set up your drupals - if you're still set up from the last demo site PR, you should be good to go
Get your local app environment set up
yarn install
Add new
autocomplete
configsrc/env.local.js.example
fileautocomplete.appendWildcard
totrue
, here is whatmine looks like:
Verify when
autocomplete.appendWildcard = true
a wildcard query is sentyarn start
COMMAND + alt + i
) for chrome / firefoxConfirm: Single word/chunks are sent with
chunk+chunk*
car
into the search fieldq
param iscar car*
&df=
Confirm: Single world/chunks ending in a space are trimmed
car
(note trailing space) into the search fieldq
param is stillcar car*
&df=
Confirm multiple word/chunks are sent with
word1+chunk2+chunk2*
so m
into the search fieldq
param is stillso m m*
&df=
Verify when
autocomplete.appendWildcard
is eitherfalse
or not set, no wildcard is appended to the querycar
into the search fieldq
param iscar
&df=
Verify trailing spaces are still trimmed from the query
car
(note the trailing space) into the search fieldq
param iscar
&df=
Verify that when no
autocomplete.suggestionRows
value is set, it defaults to 5autocomplete.suggestionRows
in yourenv.local.js
fileautocomplete.appendWildcard
to truecar
into the search fieldVerify that the main search query no longer sets a default search field in the query:
q=tm_rendered_item:<value>
q
param iscarrot
and nottm_rendered_item:carrot