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: Autocomplete #77

Merged
merged 65 commits into from Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
87f04ea
move has_site_name_property logic to form callback
mcarmichael21 Aug 6, 2018
f8c3647
Merge branch 'master' into PL-31-Change-an-alter-call-to-a-callback-f…
froboy Nov 28, 2018
0067f0f
Merge branch '8.x-1.x' into PL-31-Change-an-alter-call-to-a-callback-…
damontgomery Jan 4, 2019
0419a6d
PL-31: Set the site name based on the configuration values.
damontgomery Jan 4, 2019
f8609ff
root-198: add autocomplete config fields to search app settings page
jesconstantine Mar 5, 2019
a8befe4
root-198: organize search app settings form in field groups
jesconstantine Mar 5, 2019
e154f66
root-198: expose autocomplete config fields on enable checkbox check
jesconstantine Mar 5, 2019
90ab0d8
root-198: add docs to fieldgroups
jesconstantine Mar 5, 2019
9ec3130
root-198: namespace field names
jesconstantine Mar 5, 2019
9f6fd75
root-198: change keyboard directions input logic from show -> hide
jesconstantine Mar 5, 2019
d93aba8
root-198: save autocomplete form options to config
jesconstantine Mar 5, 2019
5a52924
root-198: avoid sending encoded empty username:pass
jesconstantine Mar 5, 2019
3728764
root-198: load autocomplete config in search app
jesconstantine Mar 5, 2019
e99c894
root-198: add search app config options to hide available facet/filters
jesconstantine Mar 6, 2019
19a6d65
root-198: update default install config
jesconstantine Mar 6, 2019
6271105
root-198: ensure append wildcard config is saved correctly
jesconstantine Mar 6, 2019
242a543
root-198: ensure autocomplete[mode] config values saved correctly
jesconstantine Mar 6, 2019
c153bb6
root-198: use boolean TRUE/FALSE instead of 1/0
jesconstantine Mar 6, 2019
9e8f1ac
root-198: fix bug where facet/filter fields don't render when should …
jesconstantine Mar 6, 2019
03abcd8
Move the autocomplete checkbox to a more visible location
agentrickard Mar 6, 2019
80aeb70
Merge branch PL-31-Change-an-alter-call-to-a-callback-for-the-form
jesconstantine Mar 6, 2019
db1a03c
root-198: stub out autocomplete functionality for search block
jesconstantine Mar 8, 2019
dd6ae6d
root-198: use Drupal.announce, highlight results, use better logic
jesconstantine Mar 8, 2019
83527aa
root-198: use view rest export
jesconstantine Mar 8, 2019
249051c
root-198: adhere to solr schema for title/url
jesconstantine Mar 8, 2019
ad5f499
root-198: add stubbed out view rest export for autocomplete
jesconstantine Mar 8, 2019
24f8aa4
Root-198: add js hook to search form
jesconstantine Mar 8, 2019
08d52db
root-198: scaffold out federated search page block config
jesconstantine Mar 8, 2019
8266d7e
root-198: make config available in drupalSettings for block
jesconstantine Mar 8, 2019
10c1e95
root-198: begin working with block config in js
jesconstantine Mar 8, 2019
7638115
root-198: create view rest export serializer to structure solr response
jesconstantine Mar 11, 2019
52cf99d
root-198: move autocomplete view to optional, use new serializer
jesconstantine Mar 11, 2019
653c62c
root-198: fix config item paths in bock config form
jesconstantine Mar 11, 2019
ae15add
root-198: update js response handler to expect solr response structure
jesconstantine Mar 11, 2019
c67c035
root-198: get url from config, append default value params, wildecard
jesconstantine Mar 11, 2019
56bb4d3
root-198: append expected params to default url
jesconstantine Mar 11, 2019
fc4c315
root-198: don't make module depend on rest (since view is optional co…
jesconstantine Mar 11, 2019
d2a981b
root-198: only expose block form autocomplete config when enabled
jesconstantine Mar 11, 2019
0397e41
root-198: support basic auth in ajax request
jesconstantine Mar 11, 2019
5b9fe14
root-198: honor the default values set in JS
jesconstantine Mar 11, 2019
09b197b
root-198: Fix bug where autocomplete is enabled was not being written…
jesconstantine Mar 11, 2019
3077d38
root-198: replace multiple instances of [val] in autocomplete URL
jesconstantine Mar 11, 2019
6b193d0
root-198: allow autocomplete to be disabled <smh>
jesconstantine Mar 11, 2019
4646c4c
root-198: attach library + drupal settings to block if autocomplete e…
jesconstantine Mar 11, 2019
b5590c2
root-198: provide better namespace for autocomplete in drupalSettings
jesconstantine Mar 11, 2019
ea1d37f
root-198: remove contextual filter display from example view
jesconstantine Mar 11, 2019
5269923
root-198: add the js trigger class to the block based on config
jesconstantine Mar 12, 2019
b25d2c7
root-198: add comment to clarify autocomplete html attribute
jesconstantine Mar 12, 2019
6009a04
root-198: remove uuid from autocomplete view
jesconstantine Mar 12, 2019
4c2f61c
root-198: update search app autocomplete url docs + other misc fixes
jesconstantine Mar 12, 2019
cd01037
root-198: emit event when a search block autocomplete option is selected
jesconstantine Mar 12, 2019
02b5816
root-198: add custom event emission to autocomplete link click
jesconstantine Mar 12, 2019
af1be88
root-198: use custom data attr (vs name) as hook to show/hide form el…
jesconstantine Mar 12, 2019
c129ae9
root-198: set install, schema, + default values for autocomplete config
jesconstantine Mar 12, 2019
74e6bd2
Merge branch '3037751-template' into root-198
jesconstantine Mar 12, 2019
7060038
root-198: fix readme, make numbered list item links render as links
jesconstantine Mar 12, 2019
99ce745
root-198: fix readme: point required schema docs to d.o guide
jesconstantine Mar 12, 2019
8787fc8
root-198: update readme: include steps to set default query fields, b…
jesconstantine Mar 12, 2019
07e756e
root-198: update readme with autocomplete config, fields, views docs
jesconstantine Mar 12, 2019
cc76a56
root-198: document autocomplete view name in readme
jesconstantine Mar 13, 2019
b5420a7
Merge pull request #78 from palantirnet/features/d8/root-198-search-b…
jesconstantine Mar 13, 2019
1aa5d0b
Merge 8.x-2.x
jesconstantine Mar 13, 2019
da717a2
root-198: bump version of react app dependency
jesconstantine Mar 14, 2019
81e3ee8
root-198: remove legacy checkbox to enable autocomplete
jesconstantine Mar 14, 2019
27c9edf
root-198: address php notices by checking for config values
jesconstantine Mar 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 19 additions & 12 deletions README.md
Expand Up @@ -10,7 +10,7 @@ Primary features of the module include:
* Indexing of multiple, independent Drupal sites into a single index
* Optional filtering of search results by site
* Standard presentation of search results on all sites
* A standard search block for use on all sites
* A standard search block for use on all sites with optional configurable type-ahead search results
* Customizable presentation using a single CSS file

### How does it work?
Expand Down Expand Up @@ -61,27 +61,34 @@ CONFIGURATION

On each site included in the federated search, you will need to:

1. Install this module and its dependencies
2. Configure a Search API server to connect to the shared Solr index
3. Configure a Search API index according to the [required schema documentation](docs/federated_schema.md)
4. Index the content for the site using Search API
1. Install this module and its dependencies
1. Configure a Search API server to connect to the shared Solr index
1. Configure that Search API server to set default query fields for your default [Request Handler](https://lucene.apache.org/solr/guide/6_6/requesthandlers-and-searchcomponents-in-solrconfig.html#RequestHandlersandSearchComponentsinSolrConfig-SearchHandlers). (See [example](https://github.com/palantirnet/federated-search-demo/blob/root-198-search-terms-field/conf/solr/drupal8/custom/solr-conf/4.x/solrconfig.xml#L868) in Federated Search Demo site Solr server config)
1. Configure a Search API index according to the [required schema documentation](https://www.drupal.org/docs/8/modules/search-api-federated-solr/federated-search-schema)
1. Optional: To help facilitate autocomplete term partial queries, consider adding a Fulltext [Ngram](https://lucene.apache.org/solr/guide/6_6/tokenizers.html) version of your title field to the index (See [example]() in the Federated Search Demo site Solr index config). Also consider adding that field as a default query field for your Solr server's default Request Handler.
1. Optional: If your site uses a "search terms" or similar field to trigger a boost for items based on given search terms, consider adding a Fulltext [Ngram](https://lucene.apache.org/solr/guide/6_6/tokenizers.html) version of that field to the index. Also consider adding that field as a default query field for your Solr server's default Request Handler.
1. Index the content for the site using Search API

Once each site is configured, you may begin to index content.

In order to display results from the Solr index:

1. Configure the application route and settings at `/admin/config/search-api-federated-solr/search-app/settings`
2. Set permissions for `Use Federated Search` and `Administer Federated Search` for the proper roles.
3. Optional: [Theme the ReactJS search app](docs/theme.md)
4. Optional: Add the federated search page form block to your site theme

1. Configure the application route and settings at `/admin/config/search-api-federated-solr/search-app/settings`
1. Set permissions for `Use Federated Search` and `Administer Federated Search` for the proper roles.
1. Optional: [Theme the ReactJS search app](docs/theme.md)
1. Optional: Add the federated search page form block to your site theme + configure the block settings
1. Optional: If you want autocomplete functionality and would prefer that results come from a view, [create a Search API search view with a rest export](https://www.drupal.org/docs/8/modules/search-api/getting-started/search-forms-and-results-pages/searching-with-views-0) or create a content view with a rest export (see the "Search API Federated Solr Block Form Autocomplete" view added as optional config for this module in `config/optional`) and use that url as your autocomplete endpoint.
1. Under format, choose Solr Serializer as the format (this wraps the view results with the same response object as Solr so they can be rendered)
1. Under format, choose fields. Add the title (for Search views, we recommend adding a full text version of your title to the index and adding that instead) and link to content (for Search views, url) fields.
1. Under format, configure settings for the fields. Use the alias `ss_federated_title` for your title field and `ss_url` for your url field.
1. Under Filter Criteria, add those fields you would like to query for the search term as an exposed filter with the "contains any word" operator (for Search views use full text field searches). For each filter, assign a filter identifier. These will be used in your autocomplete url as querystring params: `&filter1_identifier_value=[val]&filter2_identifier_value=[val]`.

### Updating the bundled React application

When changes to [federated-search-react](https://github.com/palantirnet/federated-search-react/) are made they'll need to be pulled into this module. To do so:

1. [Publish a release](https://github.com/palantirnet/federated-search-react#publishing-releases) of Federated Search React.
2. Update `search_api_federated_solr.libraries.yml` to reference the new release. Note: You'll need to edit the version number and the hash of both the CSS and JS files.
1. [Publish a release](https://github.com/palantirnet/federated-search-react#publishing-releases) of Federated Search React.
1. Update `search_api_federated_solr.libraries.yml` to reference the new release. Note: You'll need to edit the version number and the hash of both the CSS and JS files.

### More information

Expand Down
21 changes: 21 additions & 0 deletions config/install/search_api_federated_solr.search_app.settings.yml
@@ -1,8 +1,29 @@
autocomplete:
isEnabled: 0
url: ''
appendWildcard: 0
suggestionRows: ''
numChars: ''
mode: result
result:
titleText: ''
hideDirectionsText: 0
facet:
site_name:
set_default: false
is_hidden: false
federated_type:
is_hidden: false
federated_terms:
is_hidden: false
filter:
federated_date:
is_hidden: false
index:
id: ''
has_federated_date_property: false
has_federated_terms_property: false
has_federated_type_property: false
has_site_name_property: false
server_url: ''
username: ''
Expand Down