Skip to content

Commit

Permalink
Merge pull request #77 from palantirnet/features/d8/root-198-autocomp…
Browse files Browse the repository at this point in the history
…lete-config

Root-198: Autocomplete
  • Loading branch information
jesconstantine authored Mar 14, 2019
2 parents 969ae54 + 27c9edf commit ea8fb10
Show file tree
Hide file tree
Showing 14 changed files with 1,768 additions and 89 deletions.
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit ea8fb10

Please sign in to comment.