Thinking-Sphinx not returning any results in console or via web app

試著忘記壹切 提交于 2019-12-25 05:18:11

问题


Similar to these: sphinx-not-indexing, thinking-sphinx returning empty results in console, similar here

The problem description is this: I can't get any results with any parameters from Sphinx. I have a hdd scaffold, and when I try and perform a search in rails console with sphinx I get [], and that's even when I know that there are items in the database. If I do Hdd.search() I should get the same as Hdd.all, but instead I get []. I saw a post about doing Hdd.search().to_a, but that doesn't make a difference for me, I get nil. For others it seems that they sometimes get different results on their webpage than their rails console, but it isn't this way for me. My site also has search functionality and it produces [] as well.

Funny part about it is, all I've done between the time it was last working and now that it's failing is add some small modifications-namely change the model and view, make a few migrations, and install a new plugin, carrierwave. Now, it seems like between all of that, search just isn't working. I've restarted, rebuilt, reindexed thinking sphinx, but to no avail. I've also restarted the server too, and even ran it under webrick instead of apache, but the problem has essentially remained the same.

Output of:

rake ts:rebuild

using config file '/home/adam/RailsForensicsHardDriveApp/ForensicsHDD/config/development.sphinx.conf'...
indexing index 'hdd_core'...
collected 6 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 6 docs, 292 bytes
total 0.006 sec, 47510 bytes/sec, 976.24 docs/sec
indexing index 'hdd_delta'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.003 sec, 0 bytes/sec, 0.00 docs/sec
skipping non-plain index 'hdd'...
total 4 reads, 0.000 sec, 3.8 kb/call avg, 0.0 msec/call avg
total 14 writes, 0.000 sec, 2.5 kb/call avg, 0.0 msec/call avg
Started successfully (pid 6700).

I notice that I get a line in the above ^ that says "skipping non-plain index 'hdd'..."

I don't know what that means, but it sounds like it's not doing something that it should.

I have tried to debug the function using ruby debug, but that hasn't born any fruit yet. I'm hoping that somebody else has some advice from what I post that could help me.

I've run rake rails:update I've uninstalled and reinstalled thinking-sphinx gem

In this gist I have included the pertinent files. You can see that in the model, I've tried to eliminate the problem of concatenation space being too small by extending the size, but that hasn't made a difference either.

I've read the deltas documentation and the FAQ on setting up sphinx with passenger (yes, I am running rails with passenger) and I don't feel like either of those are the problem because I had sphinx running quite well before it mysteriously (to me) stopped functioning correctly.

I honestly have no idea why it's not working. I have the entire project under git, and I've tried rolling back to earlier versions when it was working, rebuilding the index and performing a search, but that doesn't seem to work. I've tried dropping the database and recreating it, re-migrating, and then rebuilding sphinx, but that hasn't worked either.


回答1:


I found that when I did sudo apt-get purge sphinxsearch and consequently reinstalled it, it somehow stopped the server from blindly continuing through an error. If you look in the model that I posted, you'll see that I had a special field used in development-type that I had moved in via a migration. I think this was preventing it from working, because I got some really odd errors after I resinstalled thinking-sphinx (both as a gem and as an apt package). After reinstalling, upon dropping the database and editing the migration so that it was now hd_type instead of type, I was able to successfully reindex the hdd and populate search results. I know that this isn't exactly precise, because I had the issue fixed before I wrote any of the final errors that I saw that would have been pertinent to understanding precisely why it was malfunctioning the way it was.

See my answer here which links back to this article, in case it provides any different context than what this answer does, which I don't think it does.




回答2:


skipping non-plain index 'hdd' is okay - this is distributed index and can't be indexed. If you take a look on indexer output

collected 6 docs, 0.0 MB

That means that you only have six documents in the index. If you don't get any errors from Sphinx it just might be that you don't have any documents that matches your search.



来源:https://stackoverflow.com/questions/11462659/thinking-sphinx-not-returning-any-results-in-console-or-via-web-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!