Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there,
I'm using search_api_solr 1.2 and search_api 1.8.
I have defined a view on my node index that tries to output the "Item language" field (ss_search_api_language).
The result always came out empty, except when enabling the "Retrieve result data from Solr" checkbox on the Solr server config page.
So I had to implement the following hook:
function hook_search_api_solr_query_alter(array &$call_args, SearchApiQueryInterface $query) {
$call_args['params']['fl'] .= ',ss_search_api_language';
}
Is this a bug or a correct behavior? If so, can it be documented?
Comment | File | Size | Author |
---|---|---|---|
#2 | 2086783-1--remove_field_handlers_for_virtual_fields.patch | 1.73 KB | drunken monkey |
Comments
Comment #1
drunken monkeyIt is expected behavior, but probably not really correct. The problem is that we currently add Views field handlers for fields which are added by data alterations (and the "Item language" field, which is added in a similar way) and don't really have any values. Since those won't show any values, except with such workarounds, they probably shouldn't be included at all.
The attached patch should remove them, please test!
For displaying the language, just use the normal language field instead.
Comment #2
drunken monkeyComment #3
grota CreditAttribution: grota commentedYep, it works
Comment #4
drunken monkeyI already wanted to commit this, but mollux mentioned a great use case for actually leaving this. But since it's Solr-specific, we should probably just support it for Solr: see #2099683: Add support for "virtual fields" in Views.
I'm waiting with this one until that other patch is (ready to be) committed.
Comment #5
drunken monkeyOK, #2099683: Add support for "virtual fields" in Views is in – so there's nothing in the way of fixing this.
Committed. Thanks for testing!