On admin/config/search/search_api/index/resource_search/status when clicking Index Now I get the following error

Notice: Undefined index: search_api_access_node in SearchApiDbService->indexItem() (line 332 of /usr/local/wwwdocs/toolkit3/sites/all/modules/search_api_db/service.inc).
Notice: Undefined index: search_api_access_node in SearchApiDbService->indexItem() (line 333 of /usr/local/wwwdocs/toolkit3/sites/all/modules/search_api_db/service.inc).
Notice: Undefined index: search_api_access_node in SearchApiDbService->indexItem() (line 332 of /usr/local/wwwdocs/toolkit3/sites/all/modules/search_api_db/service.inc).
Notice: Undefined index: search_api_access_node in SearchApiDbService->indexItem() (line 333 of /usr/local/wwwdocs/toolkit3/sites/all/modules/search_api_db/service.inc).
Notice: Undefined index: search_api_access_node in SearchApiDbService->indexItem() (line 332 of /usr/local/wwwdocs/toolkit3/sites/all/modules/search_api_db/service.inc).
Notice: Undefined index: search_api_access_node in SearchApiDbService->indexItem() (line 333 of /usr/local/wwwdocs/toolkit3/sites/all/modules/search_api_db/service.inc).
Notice: Undefined index: search_api_access_node in SearchApiDbService->indexItem() (line 332 of /usr/local/wwwdocs/toolkit3/sites/all/modules/search_api_db/service.inc).
Notice: Undefined index: search_api_access_node in SearchApiDbService->indexItem() (line 333 of /usr/local/wwwdocs/toolkit3/sites/all/modules/search_api_db/service.inc).
Couldn't index items. Check the logs for details.

The log says

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (item_id = '310')' at line 1

and the index isn't run.

Appreciate any help with this.

Thanks

Comments

ajaysolutions’s picture

I am getting this same issue when i've enabled the node access data alteration, although i think the way it behaves that it's to do with having the node access field indexed rather than the data alteration itself...

It's annoying because I can't currently stop nodes being indexed if I simply unpublish them so they still show up

agoradesign’s picture

I also have this problem. A few months ago I reported this problem: http://drupal.org/node/1351436

I think, both problems have the same root.

I was able to trick the system by doing the following:

  1. First enable the node access data alteration
  2. switch to the fields config page and uncheck the "Node access information" field + Save
  3. recheck the field and save again

Voila, the index table is now created :)

finex’s picture

The workaround suggested by @agoradesign works fine :-)

Thanks!

Kvart’s picture

Don't know if this is right place to ask, but lets try. I was able to create the index table with workaround suggested by @agoradesign (thanks), but unpublished nodes still show up in search results. Is there any way to fix this?

agoradesign’s picture

You're welcome :)

@Kvart: If you're only seeing unpublished but not published nodes, I think I know the problem: there is/was a bug in Entity API, reversing the node status. In rc1 it still happens, in the latest dev it's already fixed. Here's the issue with patch included: http://drupal.org/node/1344056

Kvart’s picture

Actually my problem was that both published and unpublished nodes were displayed in search results (i'm using search pages). Even a guest could see unpublished nodes in search results.

I made a really simple modification to fuzzy search's code to prevent that, and it's enough for me until there is a better solution.

Traverus’s picture

Category: support » bug
Priority: Normal » Major

I had the same issue and the work-around also worked for me, but I would think this is a bug, no?

Furthermore, if this is breaking content permissions and you want to now protect something that was previously unprotected, I'd say this is a pretty big issue.

pgrond’s picture

Just as a confirmation, the workaround worked for me too.

ken hawkins’s picture

Same problem here and the workaround solution in #2 by agoradesign worked to resolve.

drunken monkey’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Component: User interface » Framework
Status: Active » Needs review
StatusFileSize
new4.38 KB

Thanks for reporting this!

This was pretty difficult to debug, but I finally figured it out. Please test the attached patch and see if it reliable fixes all problems.

Status: Needs review » Needs work

The last submitted patch, 1414138--data-alteration-fields-not-correctly-added-9.patch, failed testing.

mxh’s picture

#10 did not work for me, have still the same problem.
After applying #2 it worked. Then I disabled the node access alteration and it also still works now.

drunken monkey’s picture

#10 did not work for me, have still the same problem.
After applying #2 it worked. Then I disabled the node access alteration and it also still works now.

Now that it works, can you still cause the problem, even after applying #10?

Everyone: For testing the patch in #10, please re-save the Fields form and then see whether enabling/disabling the "Node access" data alteration correctly adds/removes the search_api_access_node field.

moniuch’s picture

#10 did not work for me. Getting all variety of "link 332/333" errors, such as:

Notice: Undefined index: search_api_url in SearchApiDbService->indexItem() (line 332 of /sites/all/modules/search_api_db/service.inc).
Notice: Undefined index: search_api_viewed in SearchApiDbService->indexItem() (line 332 of /sites/all/modules/search_api_db/service.inc).

Re-installed, cleared cache. Nothing helps.

dmadruga’s picture

#2 works like a charm.
#10 doesn't work.

mxh’s picture

Now that it works, can you still cause the problem, even after applying #10?

Yes, it also works for me after applying #2 and then applying #10.

drunken monkey’s picture

@ #14: Can you please also try (after applying the patch) to disable and then re-enable the data alterations? It definitely works for me, I can't really explain why this doesn't seem to be the case for anyone else …

@ #15: Please elaborate a bit on "doesn't work". Did you test by applying the patch and afterwards enabling the data alteration?

mustanggb’s picture

Applying #10 then doing http://drupal.org/node/1347438#comment-5276694 seems to have worked so far.

Sborsody’s picture

I was getting "SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (item_id = '10')' at line 1"

and the database table for node title in the default index that comes with fuzzysearch was empty (for any fulltext field actually).

Here's what I did.

- Apply the patch from #10 to search_api
- Disable then uninstall fuzzysearch
- Enable fuzzysearch
- Go to status page and index (doesn't index anything)
- Go to the fields form for the default fuzzysearch index and hit save
- Go to status page and index
- I see the database table for title field being populated.

So in addition to this there needs to be something changed in fuzzysearch so that it's default index works out of the box.

drunken monkey’s picture

Priority: Major » Normal

Since the patch in #10 seems to solve the problem at least for some users, I now committed it. Thanks for testing!

nathan_czh’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1414138--data-alteration-fields-not-correctly-added-9.patch, failed testing.

marcoka’s picture

checking...

1.) created a clean drupal 7.15 with basic modules views, ctools and search api/search api db and dependencys
2.) created 2 taxonomies with some terms
3.) created a content type Article and added 2 vocab fields
4.) created two test Articles with some tags
5.) Added an aggregated field where i chose the "term ids" of the two created vocabs

applied patch

ERROR


    Notice: Undefined index: search_api_aggregation_1 in SearchApiDbService->indexItem() (line 332 of /mnt/www/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/sites/all/modules/search_api_db/service.inc).
    Notice: Undefined index: search_api_aggregation_1 in SearchApiDbService->indexItem() (line 333 of /mnt/www/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/sites/all/modules/search_api_db/service.inc).
    Notice: Undefined index: search_api_aggregation_1 in SearchApiDbService->indexItem() (line 332 of /mnt/www/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/sites/all/modules/search_api_db/service.inc).
    Notice: Undefined index: search_api_aggregation_1 in SearchApiDbService->indexItem() (line 333 of /mnt/www/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/sites/all/modules/search_api_db/service.inc).
    Notice: Undefined index: search_api_aggregation_1 in SearchApiDbService->indexItem() (line 332 of /mnt/www/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/sites/all/modules/search_api_db/service.inc).
    Notice: Undefined index: search_api_aggregation_1 in SearchApiDbService->indexItem() (line 333 of /mnt/www/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/sites/all/modules/search_api_db/service.inc).
    Notice: Undefined index: search_api_aggregation_1 in SearchApiDbService->indexItem() (line 332 of /mnt/www/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/sites/all/modules/search_api_db/service.inc).
    Notice: Undefined index: search_api_aggregation_1 in SearchApiDbService->indexItem() (line 333 of /mnt/www/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/sites/all/modules/search_api_db/service.inc).
    Couldn't index items. Check the logs for details.

LOG CHECK:

Type	search_api_db
Date	Thursday, September 20, 2012 - 15:04
User	marco
Location	http://192.168.1.238/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/admin/config/search/search_api/index/default_node_index/status
Referrer	http://192.168.1.238/WORKSPACE_DRUPAL/TESTPROJEKTE/drupal7_search_api_test/admin/config/search/search_api/index/default_node_index/status
Message	SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (item_id = '4')' at line 1
Severity	warning
Hostname	192.168.1.203
Operations	

second test, downloaded latest search api and search api db DEVELOPMENT versions. same error

alauzon’s picture

I have the same problem.

Undefined index: search_api_url in FuzzySearchService->indexItem()

awolfey’s picture

Status: Needs work » Fixed

This has already been committed. Also, I confirmed it works in fuzzysearch, so problems above are not related to the original issue. Changing to fixed and leaving for Drunken Monkey to close. Thanks!

Status: Fixed » Closed (fixed)

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