I'm trying out the module on a fresh install, and I'm getting this error when trying to index the nodes.
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 = '10')' at line 1
I'm using the default settings, and haven't done anything special with the site. I've created a dummy content type and generated some 150 nodes.
Module versions:
Search API 7.x-1.0-rc1
Database search 7.x-1.0-beta2
Comments
Comment #1
drunken monkeyCould you please find out the whole query (probably best from the MySQL server log) and maybe on which line the error occurred?
Comment #2
matthieu_collet commentedI created an issue with the same problem in the search api issues :
http://drupal.org/node/1348416
perhaps more intersting to merge them ?
Comment #3
adamgerthel commentedI haven't been able to test Search API with any other server index solutions than this module, and I couldn't find anything in the Search API issue queue regarding this, so I figured the issue belonged here.
@drunken monkey:
I'm not that familiar with looking into MySQL logs. I'm using MySQL on OSX installed via installer. I use Sequel Pro as UI. Any idea where I should look? This is the ConsoleLog if that helps (taken right after pushing "index now"):
Comment #4
drunken monkeyYes, it's the correct place (as far as I can tell).
I'm not familiar with OS X, or installer. There should be a my.conf file that lets you specify logging files.
The correct query will contain the
WHERE (item_id = '10')bit from above, and would probably have the mentioned error message below it.Comment #5
adamgerthel commentedI've looked around but I don't know really where to find it. Last week I turned off bin logging in MySQL because I don't use/need logging in the local dev environment and it ate up 25gb of disk space. I still have a couple of them (mysql-bin.00000XX) but I couldn't find anything useful in them.
Comment #6
Fidelix commentedHere it is.
I've removed Watchdog queries from this log, but they're essentially like this:
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 1mysql.log
Comment #7
drunken monkeyOh. Not good.
Thanks a bunch for finding this out!
Please try the following:
- Resave the index's „Fields“ form.
- If that doesn't help, apply the attached patch.
Comment #8
drunken monkeyComment #9
Fidelix commentedYeah, resaving the "Fields" form does fix it.
Do you want me to test the patch anyway?
Comment #10
adamgerthel commentedSame here- resaving fixed it
Comment #11
drunken monkeyWell, once it's fixed there is really nothing to test with the patch. Was probably some temporary version weirdness, I guess. Better just let the affected users re-save that form instead of introducing a fix for a problem that doesn't exist anymore.
Comment #12
Fidelix commented@drunken monkey, this will still affect users that do not save the fields form.
That's really confusing.
Maybe it's enough if you add an warning telling the user to save the fields form?
Comment #13
matthieu_collet commented"Resave the index's „Fields“ form." didn't work for me, but the patch did !
thank you !
Comment #15
dhayles commentedNone of the above is working for me, I'm still getting the error "Couldn't index items. Check the logs for details."
I have saved and changed the fields like a hundred times, and I can't get the patch to work.
I've upgraded to the dev version and still no luck, has anyone got any other solutions?
Comment #16
klaasvw commentedRe-saving the index fields form didn't work for me but the patch did.
I've rerolled the patch for the latest dev and did some very minor cleanup so the patch relates to this issue only.
Also changed the title to better reflect the issue.
Comment #17
dhayles commentedSorry but that patch didn't work either, I have tried everything, 1st patch, 2nd patch, saving the fields, re-saving the fields, clean drupal installation but I still get the following error:
Couldn't index items. Check the logs for details.
Could this line in my log shine any light into the problem:
SEVERE: org.apache.solr.common.SolrException: [doc=default_node_index-1] missing required field: entity_type
I have checked the field list and can confirm that there is no existing field named entity_type.
Comment #18
klaasvw commenteddhayles, I think your issue is unrelated to search_api_db. The error is clearly coming from apache solr so your issue probably belongs in the issue queue of the search_api_solr module.
Comment #19
lucascaro commentedI was using 7.x-1.0-beta and re saving the fields form didn't work. I installed 7.x-1.x-dev, re saved the form, cleared the index, cleared the cache, re indexed and got the same error message.
After that, I've applied the patch in #16 and fixed the error message. Thanks!
Comment #20
askibinski commentedSaving the fields page (/admin/config/search/search_api/index/default_node_index/fields) did the trick for me.
using:
search api 7.x-1.0-rc
search api db 7.x-1.0-beta2
no patch.
Comment #21
drunken monkeyFor those for whom re-saving didn't work (and who actually use the database search): does re-saving the "Fields" form also not fix the problem with the latest dev versions of both this module and the Search API?
Then I guess we'll really have to commit this.
Comment #22
Sinan Erdem commentedThe patch on #16 worked for me and nothing else. I am using thre latest stable versions of both modules.
Comment #23
drunken monkey#1414138-10: Notice: Undefined index: search_api_access_node might be related – could you please also test the patch there, and then see whether re-saving the Fields form works?
Comment #24
Sborsody commentedI used the patch in #16 on FuzzySearchService->itemIndex() and no longer get:
"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"
Comment #25
drunken monkeyCould you please also test the patch in #1414138-10: Notice: Undefined index: search_api_access_node and try re-saving the form?
The patch in #16 is only a last ressort.
Comment #26
Sborsody commentedOK, but I wasn't getting that error. What I found happening on my system was that with both the default fuzzysearch index and a custom index the fulltext fields were not being indexed. Their database tables were created but empty. The only error was the SQL one found in dblog.
Comment #27
Sborsody commentedHere's what I did.
- Apply the patch from #25 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.
Comment #28
ludo.rI have the same issue :
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 1I just enabled the Search API module on a fresh standard Drupal installation.
Saving fields form fixed this issue.
However, it doesn't work when I try this in my existing project with a custom Search index.
Using the Default node index works (after saving fields form).
I believe I have to figure out which fields in my custom index are throwing this error.
EDIT : it seems "Entity HTML output" is messing up the index. When I disable it, index works correctly.
Comment #29
acouch commentedRe-saving the form fixes this for me.
However I'm building a distro and this bug interferes with the site installation by spitting out a number of warning messages mentioned above. #16 fixes this for the distro as well.
Comment #30
drunken monkeyOK, committed this now, I hope this fixes the problems.
I'm very sorry for letting you all wait so long. I just thought this would have to be solvable at the root of the problem, instead of this safety code. But I guess having this fixed in some way is better than waiting perhaps indefinitely to find the real cause.
Comment #32
summit commentedHi,
Having this same error still on latest RC2 version, so I hope it is ok to set this to active again.
May be does it help that I think these are Drupal Commerce Product Id's.
Greetings, Martijn
Comment #33
drunken monkeyYes, it's OK, thanks.
Are you using the latest version of the Search API module as well?
And does the error occur when indexing or when searching? Did you re-save the index's Fields form? Are you able to reproduce the error from a clean install?
Comment #34
summit commentedHi,
I use the commerce product display search index. I think the error occurs using that.
I need to be able to search through my commerce products..
I use latest .dev of all search api modules. The error occurs when searching I think. I got the error back from many different pages and a seach box is in the right sidebar.
Yes I resaved the index field form. Because I use drupal commerce and different other modules I am not able to reproduce the error from a clean install.
Greetings, Martijn
Comment #35
drunken monkeyIs there anything in the site log, saying whether it occurs in a search or during indexing? Does it occur repeatedly when visiting pages, or just now and again? Does it always occur on the same pages? And also on admin pages?
One possible solution might be to keep on removing fields from the index and seeing if this error stops to occur at some point, then maybe a specific field would be to blame.
But right now, I haven't really got an idea what could be the problem, there's just too little information.
Comment #36
summit commentedHi,
Made a new issue from it: https://drupal.org/node/2075485
Could I not somehow with a debugstatement let show where it is going wrong, instead of this error?
Greetings, Martijn
Comment #37
drunken monkeyOK, then let's discuss this in the new issue.