Hi there, I'm using search_api 1.9 and search_api_solr 1.3.
I have an index configured in search_api_solr so that it indexes a og_vocabulary:parents_all field.
og_vocabulary is a term reference field, and it is multiple.
I have reindexed the nodes and I can see from solr's admin page (my url is the default http://localhost:8983/solr/#/collection1/query) that the data is there in solr, I do a simple query and I can see the following (excerpt):
...
"im_og_vocabulary$parents_all": [
148,
115,
207,
117,
5036,
127,
126,
5037,
127,
126
],
...
I also have a view defined that has in the field output list the field "Section: All parent terms (indexed) (All parent terms (indexed))". I print the tids, comma separated.
The problem is that only the first two 148 and 115 are being returned, am I doing something wrong?
Comments
Comment #1
grota CreditAttribution: grota commentedSmall update. I did some debugging and it seems that somewhere along the lines the core drupal function
entity_metadata_taxonomy_term_get_properties
is called and thentaxonomy_get_parents_all
, since we are dealing withparents_all
.The problem seems to be that
taxonomy_get_parents_all
is called only for the first tid of the node, resulting in itself and its parents (only one parent in this case, the tid 115).Is this a bug in search_api, by any chance? Can it possibly be related to a limitation in search_api itself regarding multiple values fields? I remember reading it somewhere but I cannot find the doc anymore.
If I do the trick of retrieving the values from solr like this, it works.
Comment #2
grota CreditAttribution: grota commentedComment #3
drunken monkeyThanks for reporting this problem! I could reproduce it locally, but wasn't able to determine how to fix it right away. I'll need to wait until I have a bit more time to look at this.
In any case, the display aspect of the Views integration is provided by the Entity API, so this issue probably belongs there.
(A few notes to myself, or to anyone else who wants to debug further: for the handler only one wrapper is set (per row), instead of an array of wrappers for all set terms (not including their ancestors yet). The problem lies probably in
EntityFieldHandlerHelper::extract_property_multiple()
. When given the taxonomy term field as the selector, it seems to only return the first one there.)Comment #4
emclaughlin CreditAttribution: emclaughlin commentedThis is actually, from what I can tell, a problem with all multi-value fields. They get wrapped in a DrupalListWrapper, and EntityFieldHandlerHelper::extract_property_multiple only returns the first one. I'm having the same issue with a field collection that has a cardinality of Unlimited.
Edited: I'm using Search API, and the view is of denormalized search results.