Currently the field mapping retrieval is nested in the apachesolr_entity_fields() between lines 1937 and 1967. I have a use case where I need to be able to get the name of the field stored in Solr from the machine name of the field. The only way I can see hoe to do this is to replicate the code in the lines mentioned above, but if there was an API function to get the mappings this task would be a lot easier.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 1825426-8.d6.patch | 4.74 KB | mkalkbrenner |
| #5 | mapping-api-function-1825426-5.patch | 4.71 KB | cpliakas |
| #1 | mapping-api-function-1825426-1.patch | 4.48 KB | cpliakas |
Comments
Comment #1
cpliakas commentedFirst crack at a patch. Marking as needs work because I do not know what the "name callback" does.
You have to follow the code trail, but the use case is illustrated by the rich_snippets_get_solr_fields() function. This calls the apachesolr_get_index_key_map() function, which requires the API function posted in this patch.
Comment #2
nick_vhpart 1
part 2
part 3
so the name callback allows you to create a different name for the solr field. Nothing super critical, but flexible enough to allow custom implementations
Comment #3
cpliakas commentedAh, I got you. So if I had an long integer field named "field_foo", I could change it to "field_bar" which would the would be stored in Solr as "i_field_bar". Is that about right?
Comment #4
nick_vhThat is completely correct! Marking this as needs review to let the testbot grind
Comment #5
cpliakas commentedRe-rolling patch with a description of the "name callback" key.
Comment #6
nick_vhNeeds backport to 6.x-3.x
Comment #7
nick_vhOh, just to clarify - this was committed. Thanks!
Comment #8
MickC commentedGetting Errors - see https://drupal.org/comment/8245857#comment-8245857
Comment #9
mkalkbrennerComment #10
mkalkbrenner