Skip to content

TROUBLESHOOTING INDICES

Tom Stovall edited this page Jan 18, 2022 · 7 revisions

Home | Best Practices | Fun With Indices | Installation | Jargon | Local Development | Processors | Troubleshooting Indices

This document answers the question: "I have everything installed and my server says "can be reached" but my index isn't returning any documents when I search. What do I do?"

Troubleshooting your search_api_pantheon search results:

  1. Get all the errors and warnings out of your theme files.

    When search_api goes to index the content, it's going to render the content using your theme. if there are errors or warnings in your theme, this will prevent your content from being correctly indexed.

  2. I know you blew through that first item and were like "This can't possibly be the problem." No, seriously. Stop now. GET ALL THE ERRORS AND WARNINGS OUT OF YOUR THEME. This is important. Poor theming will result in incomplete indexing.

  3. Verify a server round trip is working correctly.

    Using terminus run the drush command "search-api-pantheon:diagnose".

    terminus drush {site_name}.{env} -- search-api-pantheon:diagnose
    

    This command diagnoses problems with connections and can sniff out where the problem exists by what part of the command fails or succeeds. If the command completes without error, the connection to the server is working and you're ready to index.

  4. Do you have, or did you create an index?

    Don't Do!

    In order to return search results, your search server has to have at least one "index". Your index must index content from at least one datasource (ideally, "content") and you must choose "pantheon"'s driver as the server for that index.

  5. If you have special permissions on your content, make sure the index is created with the correct user context.

    Don't Do!

    We recommend that your search results index "FULL CONTENT" views of all content types.

    Do This!
  6. Once you have established the index, you will need to add fields. We recommend that unless you know what you're doing, add the "rendered content" field and the "uri" field.

    Add Fields Add Fields Add Fields
  7. Anytime you make a change in the server's fields, you will need to re-send all of your content from the site to the Solr index for indexing.

    Index Content Index Content
  8. Ajax errors when indexing:

    AJAX ERRORS!

    When you choose "index now" what is happening is search_api is going through each of the indexed entities and rendering it with your theme. That means, if there are errors or notices in your theme, the indexing process may error while rendering the node and you'll get ajax errors like the one here.

    Check the drupal error log for where the error is and resolve the theme errors to resolve issues with the indexing process.

  9. "My View still doesn't pull back any search results"

    Create a new view from scratch that uses no theming and just does a fulltext search. Then try the search using various users searching for multiple words that are known to exist in a node. You can usually figure out what's going wrong with the view this way.

    Also, you can check if Solr actually has items for your index by running the drush command "search-api-pantheon:select":

    terminus drush {site_name}.{env} -- search-api-pantheon:select "*:*"

    You could send more complex queries and other options to Solr index, just keep in mind that the way that Drupal builds the queries is usually very complex. You could append ?debug=true to any Drupal url that uses Solr to get debugging information. Part of that debugging information is the Solr query that was sent to Solr; you could copy it from there:

    Solr page with debug parameter

    Then, decode the query parameter (you could use https://www.urldecoder.org/) and send it to Solr like this:

    terminus drush {site_name}.{env} -- search-api-pantheon:select '(tm_X3b_en_body:("vegan")^1+tm_X3b_und_body:("vegan")^1+tm_X3b_en_field_recipe_instruction:("vegan")^1+tm_X3b_und_field_recipe_instruction:("vegan")^1)'