Summary: I have a fairly clean install of Drupal 7 with Apachesolr-1.0-beta18. I have created a content type called document with a number of fields. I am working with 30k+ records, most of which are related to "Marion, IA" in some way. A search for "library" (without the quotes) returns no results, while a search for "marion library" returns thousands of results. That doesn't make any sense to me at all.
Details:
- Drupal 7 (latest stable version)
- Apachesolr-1.0-beta18
- Custom content type with many fields
- LAMP stack running on Centos Linode
- PHP 5.2.x
I also checked this through the solr admin interface, running the same searches with similar results, so I can't rule out the possibility that something is configured wrong... but since I am using the solrconfig.xml and schema.xml files provided with the modules, it is also a possibility that the issue lies here as well. I have watched the logs and during the searches that produce no results but should, there is no output in the log besides the regular [INFO] about the query.
I am stumped and I am past a deadline with this project, so any help would be greatly appreciated.
UPDATE: With some help, I got this figured out. The fields with the text for "library" was not being indexed because of display settings.
To fix the issue:
- Add a custom display for "search index" under Admin > Structure > Content types > [Your content type] > manage display, in the Custom Display settings fieldset.
- Make sure to switch to the "search index" display settings - this is what I forgot to do that made this process take longer
- Set all the fields that you want to be indexed to not be hidden.
- Re-index.
- Profit!
Comments
Comment #1
nick_vhCan you copy and paste the exact query as it is being sent to solr here?
Comment #2
pyrello commentedHere are the relevant lines from the log:
As you will notice, there is actually something that seems to indicate what the problem might be, which I had missed earlier.
Comment #3
nick_vhin the worst case you can try this query
solr/select/?q=library&rows=10&wt=xml&indent=true&debugQueryI removed the facet code from your query, would you be so kind to run this query directly to your solr instance?
As far as I see this, it should query the content field. If you have your fields hidden in the display properties it might be possible that it can't find your content. Make sure your display mode "search index" is set correctly with the right fields.
Comment #4
pyrello commentedOkay... I tried adding the "Search Index" as a custom display and set every field to not be hidden. I then deleted the index and re-indexed. I am still getting no results for "library" (without quotes)
I notice in the tomcat logs that I am still seeing the following message whenever I run the "library" search through my drupal site:
When I run the first query above (I added "=on" to the very end to get the debugging to work), I get the following response back:
When I run the second query above (with the same modification), I get the following results:
Thanks for the prompt responses. It is greatly appreciated!
Sean
Comment #5
nick_vhit seems it is searching for librari instead of library? Did you modify other solr config files?
http://www.junlu.com/list/15/972593.html might be able to help you. It could be that your solr is corrupt. Are you running tomcat or jetty? For debugging purposes I'd recommend jetty.
Comment #6
pyrello commentedOkay, I just discovered that before, when I thought I was setting up the correct "Search Index" display settings, that actually I was just changing the default settings and leaving the search index settings as they were. I am going to re-index and see if this makes a difference.
Thanks!
Sean
Comment #7
pyrello commentedThis fixed the issue I was having. Thanks for all the help!
Comment #8
nick_vhIt would be good for others to know how you fixed it
Comment #9
pyrello commentedWhen I created the content type "Document," it did not automatically have a "Search Index" custom display. I had set all except one field to not display in the default display settings. So, it appears that only that one field was being indexed (which explains why the indexing went so fast for 30k+ nodes).
To fix the issue:
Much thanks to @Nick_vh for his help in figuring out this issue!
Comment #9.0
pyrello commentedUpdated issue summary.
Comment #10.0
(not verified) commentedAdding fix information.