I have several cck fields that I want to index individually and have them returned in the search results. These are not facet filter fields. I just need to be able to have them in separate fields in the search results so I can theme them for output without having to do a node_load. I use the apachesolr_update_index hook to add my fields like this.
$document->field_description = $node->field_description[0]['value'];
$document->field_price = $node->field_price[0]['value'];
I also added the fields to the schema.xml file like this.
<field name="field_description" type="text" indexed="true" stored="true"/>
<field name="field_price" type="text" indexed="true" stored="true"/>
I restarted the Solr server and cleared my index and rebuilt it. When I go to the search index page (/admin/settings/apachesolr/index) I see my new fields. They are showing as index type of "text" and they have thousands of unique index entries. But when I search and retrieve nodes with these cck fields and I look at the search response object that the Solr engine returns (in apachesolr_search_search function) I don't see my new fields.
Any suggestions for what might be going wrong?
Comments
Comment #1
JacobSingh commentedHi Der,
See the params array in apachesolr_search_search()
We declare what fields we want there. You can implement hook_query_alter to get at your fields.
Best,
Jacob
Comment #2
dreed47 commentedAhh, that was the missing piece. I assume you mean the hook_apachesolr_modify_query() hook? This is what my hook function looks like and it worked great.
Thanks!
Comment #3
JacobSingh commentedyep, that's the one.
Sorry, was 1/2 brain dead.