Skip to content

Commit

Permalink
Merge pull request #82 from palantirnet/7x2-form
Browse files Browse the repository at this point in the history
[WIP] Updates the form and configuration
  • Loading branch information
agentrickard authored Apr 25, 2019
2 parents f7a2714 + a9ce6ed commit 9fc28a3
Show file tree
Hide file tree
Showing 11 changed files with 2,189 additions and 249 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,22 @@ On each site included in the federated search, you will need to:
In order to display results from the Solr index:

1. Configure the application route and settings at `/admin/config/search/federated-search-settings`
2. Set permissions for `Use Federated Search` and `Administer Federated Search` for the proper roles.
3. Optional: [Theme the ReactJS search app](https://www.drupal.org/docs/7/modules/search-api-federated-solr/search-api-federated-solr-module/theming-the-reactjs-search)
4. Optional: Add the federated search page form block to your site theme
1. Set permissions for `Use Federated Search` and `Administer Federated Search` for the proper roles.
1. Optional: Configure default fields for queries. The default query field for search queries made through the proxy provided by this module is the `rendered_item` field. To set a different value for the default query fields there are two options:
1. Set `$config['search_api_federated_solr_proxy_query_fields']` to an array of _Fulltext_ field machine names (i.e. `['rendered_item', 'full_text_title']`) from your search index in `settings.php`.
- This method will not work if you disable the proxy that this module provides for querying your solr backend in the search app or block autocomplete settings
- By default, the proxy will validate the field names to ensure that they are full text and that they exist on the index for this site. Then it will translate the index field name into its solr field name counterpart. If you need to disable this validation + transformation (for example to search fields on a D8 site index whose machine names are different than the D7 site counterpart), set `$config['search_api_federated_solr_proxy_validate_query_fields_against_schema']` to `FALSE`. Then you must supply the _solr field names_. To determine what these field names are on your D7 site, use the drush command `drush sapifs-f`, which will output a table with index field names and their solr field name counterparts.
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/master/conf/solr/drupal8/custom/solr-conf/4.x/solrconfig_extra.xml#L94) in Federated Search Demo site Solr server config)
1. Optional: [Theme the ReactJS search app](https://www.drupal.org/docs/7/modules/search-api-federated-solr/search-api-federated-solr-module/theming-the-reactjs-search)
1. Optional: Add the federated search page form block to your site theme

## Adding Solr query debug information to proxy response

To see debug information when using the proxy for your search queries, set `$conf['search_api_federated_solr_proxy_debug_query']` to `TRUE` in your settings.php.

Then user your browsers developer tools to inspect network traffic. When your site makes a search query through the proxy, inspect the response for this request and you should now see a `debug` object added to the response object.

*Note: we recommend leaving this set to `FALSE` for production environments, as it could have an impact on performance.*

## Updating the bundled React application

Expand Down
83 changes: 83 additions & 0 deletions css/search_api_federated_solr_autocomplete.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#autocomplete-wrapper {
position: relative;
}

#federated-search-page-block-form .search-autocomplete-container {
position: absolute;
border: 1px solid #999;
background: #fff;
z-index: 1000;
width: 100%;
display: block;
}

#federated-search-page-block-form .search-autocomplete-container:not(.visually-hidden) .search-autocomplete-container__title {
font-size:.8em;
line-height:1.46667em;
position: relative;
font-weight: bold;
padding: 10px 20px;
border-bottom: 1px dashed #ccc;
display: block;
}
.search-autocomplete-container:not(.visually-hidden) .search-autocomplete-container__close-button {
font-size:.8em;
line-height:1.46667em;
font-style:normal;
padding:3px 7px;
border-color:#ccc;
color:#333;
cursor:pointer;
position:absolute;
right:5px
}

.search-autocomplete-container:not(.visually-hidden) .search-autocomplete-container__close-button:hover {
border-color:#b5b5b5;
background-color:#f6f6f6
}

#federated-search-page-block-form .search-autocomplete-container:not(.visually-hidden) .search-autocomplete-container__directions {
display: block;
padding:10px 20px;
}

#federated-search-page-block-form .search-autocomplete-container:not(.visually-hidden) .search-autocomplete-container__directions-item {
display: block;
font-size:.8em;
line-height:1.46667em;
}

.search-autocomplete-container:not(.visually-hidden) .autocomplete-suggestion {
cursor:pointer;
background-color:#fff;
white-space: nowrap;
}

.search-autocomplete-container:not(.visually-hidden) .autocomplete-suggestion__link {
display: block;
color:#737373;
text-decoration: none;
font-size:.8em;
line-height:1.46667em;
padding:15px 20px;
border:1px solid #fff;
border-bottom-color:#ccc;
}

.search-autocomplete-container:not(.visually-hidden) .highlight .autocomplete-suggestion__link,
.search-autocomplete-container:not(.visually-hidden) .autocomplete-suggestion__link:hover {
text-decoration: underline;
background-color:#f6f6f6;
border:1px solid #f6f6f6;
border-bottom-color:#ccc;
}

.autocomplete-selected {
background: #f0f0f0;
}

.visually-hidden {
position: absolute !important;
clip: rect(1px 1px 1px 1px);
}
Loading

0 comments on commit 9fc28a3

Please sign in to comment.