I'm trying to use apachesolr with the CCK to index and present an added field ('author') as a facet. Looking at the code and reading the issue queue, I see this is limited to text fields that use a select widget. The issue discussions are ambiguous as to why this is - in #336157: CCK field indexing broken robertDouglass references a 'safe' fix, which apparently embeds
tags in the field, breaking facets, while elsewhere (sorry, lost the link) there was reference to the potentially large number of facets being the issue.
Which is it? Are we likely to see this feature in the future? Is there an issue with hacking it in myself that I should be aware of?
BTW, hook_apachesolr_cck_field_mappings is insufficient for text fields - it is overwritten immediately.
Comments
Comment #1
pwolanin commentedYes, I think that hook does need work to enable proper use with a variety of CCK fields. We will disucss such refactorings and fixes next week at Drupalcon.
Comment #2
moshe weitzman commentedI agree that it would be useful to have these fields as optional facets. Admins can be informed about the risks of too many values.
Comment #3
pwolanin commentedWe should at least un-break the APi. I"m not sure we shoudl support this in the standard module, but it should be made easy to support w/ custom code if required. For "tagging" in general we already have the taxonomy module.
Comment #4
moshe weitzman commentedI'm not sure what un-break the API means or how to proceed with this.
Comment #5
kcoop commentedThe current hook_apachesolr_cck_field_mappings allows you add fields to the map, but then the resulting merge overwrites any that use the same key (i.e. text). It would be better to create the defaults first, then pass in an array reference.
But has the bigger question (whether cck text fields that use a text field for their input are indexed) been addressed? This seems a pretty big limitation.
Comment #6
ceejayoz commentedSubscribing.
Comment #7
robertdouglass commented@kcoop: I *believe* that all cck text fields get indexed. If not it is a shortcoming of this code:
Note that this is just rendering the node and smooshing all of its text together, so the text fields are not their own Solr index fields, but are part of the combined text field.
Yes, we need to fix this API. I just wrote an article about the API which should help people understand better about how it works: http://acquia.com/blog/understanding-apachesolr-cck-api
Comment #8
pwolanin commentedCCK text fields are indexed as part of the body. They are not indexed separately at the moment unless they are using optionwidgets.
Comment #9
robertdouglass commented@pwolanin - right - and if anyone observes otherwise it is a bug so they should please report it =)
Comment #10
pwolanin commentedsee: http://drupal.org/node/271753