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

Conversation

jesconstantine
Copy link
Contributor

@jesconstantine jesconstantine commented Mar 6, 2019

This PR adds search app + block config for autocomplete + hidden facet/filters. It also adds fieldsets to the search app config form for a better UX.

To Test

Reprovision your vm

  1. Pull down root-198-search-terms-field in the federated-search-demo repo

Confirm you're able to provision the machine with updated solr config

  1. If your vm is already up (and you are ssh'd in) exit and run vagrant provision or boot your vm if it is not already with vagrant up --provision
  2. Observe provisioning finishes successfully
  3. For the curious, confirm the new solrconfig_extra.xml has been copied by ssh'ing into the vm, and running vim /var/solr/drupal8/conf/solrconfig_extra.xml.
    1. From vim press /tm_render then press ENTER which should execute a search and bring you to the line defining default query fields: <str name="qf">tm_rendered_item tem_full_text_title tem_search_terms</str> which did not exist prior to this PR.
    2. Press :q! to exit vim

Confirm you're able to build all of the sites successfully

  1. From the project root within the vm, build and install all of the sites, with new default terms (for D8 sites) by running phing build install-all (this should take a few minutes to complete)
  2. Observe the sites all build successfully

Initialize module repos + set search_api_federated_solr

  1. From the project root within the vm, initialize the modules for development by running phing init
  2. Check out the branch in search_api_federated_solr for the changes in this PR (autocomplete config, hide facet/filter values, field sets)
    1. From your host machine, in the project root: cd src/search_api_federated_solr
    2. Fetch or pull down updates from origin
    3. Check out features/d8/root-198-autocomplete-config

Add federated terms to the Recipe Category terms

  1. Log in to the site drush @fsd-d8.local uli
  2. Browse to http://d8.fs-demo.local/admin/structure/taxonomy/manage/recipe_category/overview
  3. Add the appropriate federated term for the recipe category:
    • Recipe Category>Accompaniment
    • Recipe Category>Dessert
    • Recipe Category>Main Course
    • Recipe Category>Snack
    • Recipe Category>Starter

Re-index site content (to add federated terms)

  1. Browse to: http://d8.fs-demo.local/admin/config/search/search-api/index/federated_search_index
  2. Clear indexed content
  3. Re-index content

Confirm you can successfully search from the solr admin without entering in tm_rendered_item: before your term in the common > q field

  1. Log in to the Drupal 8 standalone site and clear / re index your content
    1. drush @fsd-d8.local uli
    2. browse to http://d8.fs-demo.local/admin/config/search/search-api/index/federated_search_index
  2. Browse to http://federated-search-demo.local:8983/solr/#/drupal8/query
  3. Enter a search term (for example 'hear') in the common > q field
  4. Observe you get a search result
    image

Confirm you can see federated terms in the index now

  1. Browse to http://federated-search-demo.local:8983/solr/#/drupal8/query
  2. Enter veg in the common > q field
  3. Observe your search works and that second item Super easy vegetarian pasta bake has federated terms

Confirm that the title boost is honored

  1. From the solr admin UI http://federated-search-demo.local:8983/solr/#/drupal8/query search for car
  2. Observe that Let's Hear it for Carrots is the first result because the title boost is more than the rendered item boost
  3. Protip: check the debugQuery box and re-execute your search
  4. Then scroll down to the end of the results to the debug.explain section and observe the boost results

Confirm the search terms boost is honored

  1. From the solr admin UI http://federated-search-demo.local:8983/solr/#/drupal8/query search for past
  2. Observe the results (the first result should be Super easy vegetarian pasta bake
  3. Edit the Deep Mediterranean Quiche recipe node (you can try: http://d8.fs-demo.local/node/7/edit)
  4. Add pastry to the search terms field
  5. Save the node
  6. Open the solr admin UI in another tab http://federated-search-demo.local:8983/solr/#/drupal8/query and search for past again
  7. This time observe Deep mediterranean quiche appears first because of the search term boost which is higher than title, which is higher than rendered_item

Configure autocomplete in the Search app

  1. Browse to http://d8.fs-demo.local/admin/config/search-api-federated-solr/search-app/settings
  2. Observe the new fieldsets to organize config sections (note: putting form elements in fieldsets does not change their field value and does not change their config value, but feel free to check all of the options):
    image
  3. Observe a new SEARCH RESULTS PAGE > SEARCH FORM > AUTOCOMPLETE fieldset appears at the bottom of the page
  4. Observe the "Enable autocomplete..." checkbox
  5. Observe that upon checking that checkbox, new fields are exposed below to configure autocomplete
  6. Confirm that all new options are available, are clear, and that help text makes sense:
    1. URL
    2. wildcard
    3. number of results
    4. number of characters
    5. result mode (question: should we not make this an option as we don't yet fully support terms?)
    6. title text
    7. hide keyboard directions
  7. Click the SEARCH RESULTS PAGE > FACETS & FILTERS fieldset
  8. Observe the Set the "Site name" facet to this site option remains
  9. Observe the new options in HIDE FACETS / FILTERS FROM SIDEBAR
  10. Confirm that all new options are available, are clear, and that help text makes sense
  11. Manipulate configuration options from any/all fieldsets, save config
  12. Conduct a search from the demo site search block or browse to the search app you've set (defaults to /search-app -- remember the default site name will value will not be set if you simply browse to this, but it will if you search from the search form)
  13. Continue playing with autocomplete config values until satisfied they work as intended

Configure the search block with autocomplete functionality

  1. Browse to the block layout page http://d8.fs-demo.local/admin/structure/block/list/umami
  2. Find and configure the Federated Search Page Form block in the highlighted region.
  3. Observe new autocomplete config options in new fieldset
    image
  4. Test various autocomplete options
    1. Test with the default (solr index /select handler) and the view (see updated README for context)
  5. Browse to any page on the site and confirm autocomplete works as expected, confirm default value for site name is still passed to app in qs from form if the app is configured accordingly

To test the install config (including the view)

This felt a bit hacky but it also worked, I think

  1. Uninstall the module drush @fsd-d8.local pmu -y search_api_federated_solr
  2. Remove any trace of it from your local config in config/sites/d8:
    • disable the search_api_federated_solr module in core.extensions
    • block.block.federatedsearchpageformblock
    • block.block.stark.federatedsearchpageformblock
    • image.style.search_api_federated_solr_image.yml
    • search_api_federated_solr.search_app.settings
  3. Import config drush @fsd-d8.local cim -y
  4. Install the module drush @fsd-d8.local en -y search_api_federated_solr
  5. Browse to the views: http://d8.fs-demo.local/admin/structure/views
  6. Observe "Search API Federated Solr Block Form Autocomplete" appears in the view list

Set the block autocomplete up to work with the view

  1. Configure the search app with the index
  2. Place the block in the highlight region + configure autocomplete
    1. For the block autocomplete URL, use the View path (you'll need to add the as params, follow the help text for the block autocomplete endpoint field and docs in the readme file for this module -- ping Jes if you need help (which means we need better docs!))

mcarmichael21 and others added 19 commits August 6, 2018 14:28
…for-the-form

# Conflicts:
#	search_api_federated_solr.module
The form values had not been set yet, so I used the configuration values which is what the form is doing down the codebase.

I also set defaults in case it isn't found.

I'm not sure how to test this on the app yet and I reached out for more information.
Note: this affects neither their form state value nor config structure
@agentrickard
Copy link
Contributor

This is all working as expected. Two things to check:

  • The new CSS might be making the Umami theme on the search page look odd.

screen shot 2019-03-06 at 1 19 54 pm

  • I think the autocomplete checkbox is hidden and hard to find. I tried to move it.

@jesconstantine
Copy link
Contributor Author

Good call with enable autocomplete form input! Looking at the styles now.

@agentrickard
Copy link
Contributor

Also check to see that you don't have this error

Message | Notice: Undefined index: search_index in search_api_federated_solr_form_search_api_federated_solr_search_app_settings_alter() (line 127 of /var/www/federated-search-demo.local/web/d8/docroot/modules/contrib/search_api_federated_solr/search_api_federated_solr.module)

I've been swapping versions and it may be unrelated.

@jesconstantine
Copy link
Contributor Author

@agentrickard updated the styles in the custom module:
image

See demo site PR: palantirnet/federated-search-demo#21

@jesconstantine
Copy link
Contributor Author

jesconstantine commented Mar 6, 2019

@agentrickard I do see that notice in my recent log messages. I see #43 which a) appears to address this and b) provided the approach taken in my branch with the exception of removing the offending code.

I'd like to merge this branch in to mine and rebuild, retest, and confirm the messages no longer occur.

@jesconstantine jesconstantine changed the title Root-198: add autocomplete + hidden facet/filters config Root-198: Autocomplete Mar 13, 2019
@agentrickard
Copy link
Contributor

'Enable autocomplete for the search results page search form' checkbox appears twice -- once in the fieldset and once outside it.

@jesconstantine
Copy link
Contributor Author

thanks @agentrickard, not sure how i missed that... on it

@jesconstantine
Copy link
Contributor Author

@agentrickard the first checkbox should be removed now and the autocomplete fieldset should always be visible now. It should be expanded when the page load if it it's enabled. And enabling should reveal the rest of the autocomplete options.

@jesconstantine
Copy link
Contributor Author

@agentrickard is on a plane but agreed this is ready to move forward, merging! ✈️ 📦

@jesconstantine jesconstantine merged commit ea8fb10 into 8.x-2.x Mar 14, 2019
@jesconstantine jesconstantine deleted the features/d8/root-198-autocomplete-config branch March 14, 2019 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants