1

I'm running a Drupal 8.6.13 site with Search API 8.x-1.12 and Search API Solr Search 8.x-2.7. Everything seems to be properly installed and configured - my Solr admin panel shows a configured core and everything looks fine on my Drupal admin interface. I have the index set to process the body fields of my content and custom blocks using the fulltext type; I have 198 items indexed:

{ "response":{"numFound":198,"start":0,"maxScore":1.0,"docs":[] }}

The problem is that a search for a word that definitely appears in my content isn't producing any results. I'm using the config files from the Search API Solr Search module.

Solr Search Devel shows the request being sent to the server and an HTTP "200 OK" response being received. The logged response was:

{ "response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[] }}

What else could I be missing?

Some more detail:

I can retrieve documents from the index using a command line query, like this:

$ curl "http://localhost:8983/solr/mycore/select?indent=on&q=:"

Here's an example of one of the returned documents:

  { 
    "id":"6a1a2p-content-entity:node/100:und",
    "sm_context_tags":["search_api_X2f_index_X3a_content",
      "search_api_solr_X2f_site_hash_X3a_6a1a2p",
      "drupal_X2f_langcode_X3a_und"],
    "tm_body_1":["Ignition Timing (Vacuum advance disconnected, lines plugged) 6° BTDC Dwell Angle 30-33° Point Gap .020\" Spark Plug Gap .035\" Idle RPM * (Manual Transmission, no A/C) 725 Idle RPM * (Manual Transmission, with A/C) 725/500 ** Idle RPM * (Automatic Transmission, no A/C) 675 Idle RPM * (Automatic Transmission, with A/C) 675/500 ** Firing Order 1-5-4-2-6-3-7-8 * Set idle speed with headlights on high beam, air conditioning off. ** Higher RPM, solenoid energized. Lower RPM, solenoid de-energized.  "],
    "spell":["Ignition Timing (Vacuum advance disconnected, lines plugged) 6° BTDC Dwell Angle 30-33° Point Gap .020\" Spark Plug Gap .035\" Idle RPM * (Manual Transmission, no A/C) 725 Idle RPM * (Manual Transmission, with A/C) 725/500 ** Idle RPM * (Automatic Transmission, no A/C) 675 Idle RPM * (Automatic Transmission, with A/C) 675/500 ** Firing Order 1-5-4-2-6-3-7-8 * Set idle speed with headlights on high beam, air conditioning off. ** Higher RPM, solenoid energized. Lower RPM, solenoid de-energized.  "],
    "site":"http://example.com/",
    "sort_title":"PRD2\u0005\u000eRH\u0004NH2.:4:.*P:FDN\u0000",
    "_version_":1630197909793275904,
    "ss_search_api_datasource":"entity:node",
    "sort_body_1":":6D:P:FD\u0004P:B:D6\u0004\t<8e>T*.RRB\u0004*0T*D.2\u00040:N.FDD2.P20\u0006\u0004@:D2N\u0004H@R6620\t<90>\u0004\u001f\fS\u0004,P0.\u00040V2@@\u0004*D6@2\u0004\u0019\u0013\u0005\u000e\u0019\u0019\fS\u0004HF:DP\u00046*H\u0004\b\u0013\u0017\u0013\tx\u0004NH*L>\u0004H@R6\u00046*H\u0004\b\u0013\u0019\u001d\tx\u0004:0@\u0000",
    "index_id":"content",
    "ss_title":"Tune-Up Specifications",
    "hash":"6a1a2p",
    "ss_search_api_id":"entity:node/100:und",
    "timestamp":"2019-04-07T22:57:56Z",
    "ss_search_api_language":"und"}

So then I tried a query using a term found in the content above:

$ curl "http://localhost:8983/solr/mycore/select?q=solenoid" { "response":{"numFound":0,"start":0,"docs":[] }} $

Why might the second query fail to produce results if the search term is included in the document as shown in the full list of results?

2
  • Hello and welcome to Drupal Answers! Can you add details about how the search results page is built? Is it a view page of the index created by the Search API module or build using a custom module?
    – AjitS
    Apr 7, 2019 at 16:39
  • I'm using the Search API Pages[1] module to display the result and to provide the page and block that contains the input form. [1]: drupal.org/project/search_api_page Apr 7, 2019 at 20:11

2 Answers 2

0

Few observations that might help you.

  1. Term "solenoid" is only listed in 2 fields "tm_body_1" and "spell". Are you sure your solr instance is searching on these fields ?
  2. Can you try creating a view and see if you get some response / results ?
  3. Not sure, but did you copied over the Solr config files that are part of the module(search_api_solr), in your solr instance ?
  4. Which version of Solr you are using, as module version 8.x-2.7 supports 6.x and 7.x version - https://git.drupalcode.org/project/search_api_solr/tree/8.x-2.7/solr-conf.

Hope that helps !!

2
  • Ditching Search API Pages, reconfiguration, and using a view did the trick. The only thing I'm not getting now is having the search results displayed so that the phrase containing the search term is displayed and highlighted. What I'm getting is the start of the body field that contains the term(s). Is there something I can change in the view to change that behavior? I currently have the view configured to Show: Fields. Apr 10, 2019 at 22:23
  • This is how I do it. I would collate all the data to be searched upon, like multiple fields into one field named content (and spell in case of autocomplete) and would search on that specific field in Solr. When the document ID is returned, I pick the ID title and other field to show its data, via Views. As far as highlighting is concerned, I believe, there is a field in view, that would return the teaser with highlighting. Apr 12, 2019 at 4:36
0

Never mind, figured it out. I went back to the index and added a highlight postprocess query. I then adjusted the view settings to display the excerpt, and all is good. Thanks for giving me the right things to think about.

This was all for a Solr 7.7.1 server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.