Search by Page suddenly stopped returning results on a production Drupal site. No major changes were made to the site in terms of upgrades or maintenance, so the fact that module stopped working suddenly is kind of a shock.

http://www.courtinnovation.org/search-results/research

Meanwhile, the site's core search works fine.

http://www.courtinnovation.org/search/node/research

Anyone else ever see anything like this? Here's a short list of the overrides we current have on SBP:
search-by-page-form.tpl.php (for custom HTML)
hook_form_search_by_page_form_alter (added a wrapper div)
theme_preprocess_search_by_page_form (used to re-write the keys and submit elements of the form)
theme_search_by_page_results_title (used to rewrite the title)

Comments

jhodgdon’s picture

Category: bug » support
Priority: Major » Normal

I am not sure what would make Search by Page suddenly stop working....

Core search and Search by Page do not use the same indexes. You might go to the Search Settings page and verify that Search by Page says that it is completely indexed, and/or run cron a few times to make sure it is.

You might also verify your Search by Page environment settings, and make sure the node types etc. are set correctly. Possibly someone visited that page and changed something?

chromix’s picture

Category: support » bug
Priority: Normal » Major

Some things I've already tried:

  • creating a different search environment that only searched a small number of node types (without indexing pages)
  • clearing and reindexing the entire search index
jhodgdon’s picture

Category: bug » support

So you are saying that when you created a different search environment, ran cron until the Search Settings page showed everything was fully indexed, and then tried a search in your new search environment, you still got no results?

In that case, all I can suggest is that maybe you have a database or server problem. I don't know why else teh Search by Page module would suddenly stop working.

chromix’s picture

Category: support » bug

Yeah I tried starting over with a whole new environment and enabled only a couple simple nodes for the search and then ran cron repeatedly until the index was fully completed. I still couldn't get search by page to show any results at all.

http://www.courtinnovation.org/search_pages/research

I'm not sure where the breakdown would be at this point.

jhodgdon’s picture

Category: bug » support

Sorry, I don't have any more ideas for you. Software doesn't generally just stop working completely unless you have a problem with your server or MySQL or something like that. Which is why this is likely a support request and not a bug report. You might also look at your Drupal logs to see if there are any error messages...

chromix’s picture

Category: support » bug

That's what I was afraid of. Should we try the dev release or is that unlikely to contain any fixes for this?

chromix’s picture

Gotcha. I was just holding out hope that someone had seen the same thing. If I ever figure out what caused this problem I'll report back.

chromix’s picture

Category: support » bug

I found the following error iterated over and over in the logs:
Table 'cci.sbptt958905734' doesn't exist query: SELECT SUM(i.score * t.count) AS score FROM search_index i INNER JOIN search_total t ON i.word = t.word INNER JOIN sbp_path sp ON i.sid = sp.pid LEFT JOIN (sbpa_files saf INNER JOIN (node sbpa_n INNER JOIN node_access sbpa_na ON sbpa_na.nid = sbpa_n.nid) ON sbpa_n.nid = saf.nid AND sbpa_n.vid = saf.vid ) ON sp.modid = saf.fid LEFT JOIN (node sbpn_n INNER JOIN node_access sbpn_na ON sbpn_na.nid = sbpn_n.nid) ON sbpn_n.nid = sp.modid LEFT JOIN sbptt958905734 sbpp ON sbpp.pid = sp.modid WHERE ((0=1 OR (sp.from_module = 'sbp_attach' AND 1=1 AND (0=1 OR (saf.source = 'cck' AND (1=1))) AND sbpa_n.status = 1 AND (sbpa_na.grant_view >= 1 AND ((sbpa_na.gid = 0 AND sbpa_na.realm = 'all') OR (sbpa_na.gid = 0 AND sbpa_na.realm = 'og_public')))) OR (sp.from_module = 'sbp_nodes' AND sbpn_n.status = 1 AND (sbpn_na.grant_view >= 1 AND ((sbpn_na.gid = 0 AND sbpn_na.realm = 'all') OR (sbpn_na.gid = 0 AND sbpn_na.realm = 'og_public')))) OR (sp.from_module = 'sbp_paths' AND sbpp.perm = 1)) AND sp.environment=1 AND sp.language='en') AND (i.word = 'sample' OR i.word = 'documents') AND i.type = 'search_by_page' GROUP BY i.type, i.sid HAVING COUNT(*) >= 2 ORDER BY score DESC LIMIT 0, 1 in modules/search/search.module on line 946.

chromix’s picture

Category: bug » support

Yeah there's definitely something going on in the database... I'll switch this to support request... sorry to bother you about this, but thank you for your help.

jhodgdon’s picture

I think that is a temporary table that it is complaining doesn't exist -- a table that a query is creating as part of the search process.

You might verify that the Drupal database user has "create temporary tables" permissions on your database. Maybe your web host changed that recently?

chromix’s picture

Yep. I can see that permissions on the MySQL db have definitely been locked down recently. That's more than likely the problem. Thanks for your help!

chromix’s picture

Category: bug » support
Status: Active » Fixed

Adding temporary table creation access for Drupal's user in MySQL fixed the problem. Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

greggles’s picture

Title: Search by Page returning no results » Search by Page returning no results if mysql user cannot create temporary tables
Component: Main Search by Page module » Documentation
Category: support » task
Status: Closed (fixed) » Active

Re-opening this. In Drupal 5 and below temporary tables were required so it was common to have that permission. For 6.x and above it is not common any more and I think the README.txt (or an INSTALL.txt) should mention the need for this permission.

For what it's worth, this command worked for me:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES
ON databasename.*
TO 'username'@'localhost' IDENTIFIED BY 'password';

jhodgdon’s picture

OK, I'll make sure that is added to the README for 6/7. Thanks!

jhodgdon’s picture

And by the way this is only required for the Search by Page Paths sub-module, I think (will verify before adding to readme).

jhodgdon’s picture

Status: Active » Fixed

This has been added to 6.x's README file in the development version. It has also been taken care of for 7.x, but as I'm in the middle of another issue, the change has not been committed yet (should be later today, in conjunction with #815864: Update Search by Page for current version of Internationalization Strings).

jhodgdon’s picture

Actually, I went ahead and committed the change to the README file for 7.x now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.