Setup
- Solr version:10.0
- Drupal Core version:10.6.10 && 11.3.x
- Search API version: 1.41.0
- Search API Solr version:4.x-dev (as of Jun 9th 2026)
- Configured Solr Connector: Standard
Issue
We are testing Solr 10 and for that we wanted to give 4.x-dev a try. Other than some URL/Message info errors in the Server, everything looked ok on a first index, until we tried to search. Some Core Fields (working on every previous release and our multiple servers) were sent to Solr as "m_" fields, in specific Solr Date Range ones.
On further inspection of 4.x-dev, I noticed that "prefix" is no longer part of the annotation and old Doctrine Plugin definitions are already removed in favor of PHP ones
So. Here is what I am seeing.
E.g "solr_date_range" implements SearchApiDataTypePrefixInterface (nice) and that allows a getPrefix() method instead of having it in the annotations. That method is called in Custom (Derivative) Plugins but (keep reading after the code)
/**
* Provides a date range data type.
*/
#[SearchApiDataType(
id: 'solr_date_range',
label: new TranslatableMarkup('Date range'),
description: new TranslatableMarkup('Date field that contains date ranges.'),
fallback_type: 'date',
)]
class DateRangeDataType extends DateDataType implements SearchApiDataTypePrefixInterface {
/**
* {@inheritdoc}
*/
public static function getPrefix(): string {
return 'dr';
}
}
Never here at
https://git.drupalcode.org/project/search_api_solr/-/blame/4.x/src/Plugi...
Because
https://git.drupalcode.org/project/search_api_solr/-/blob/4.x/src/Utilit... calls the native Search API Plugin manager which won't have "prefix" in its plugin definition (except for derivative ones where the is an actual except where ::getPrefix() is called and added to the definition)
And all the rest of the prefixes (date, etc) are added fixed (array deep merge) /directly to the end result.
Which leads at the end that our "solr_date_range " are now m_field_name in Solr and we can no longer do range queries.
To me it seems like either we load every plugin definition inside
public static function getDataTypeInfo($type = NULL)
and if they are instanceof SearchApiDataTypePrefixInterface, initialize the Object, call the getPrefix method and append to the datatype info array OR every custom type becomes a derivative one
Any ideas? this is really breaking so tagged as major
Thanks a lot
Issue fork search_api_solr-3595552
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
diegopino commentedI added a tentative (maybe naive) solution. Since the method is static, its a simple case of checking if the $types/definition class in the by the Search API Plugin Manager implements (sub class of) SearchApiDataTypePrefixInterface and if so, invoke it and add the prefix. I also added skipping calling the method in case it was already set (e.g by a deriver invocation?). Not sure how useful that is
Not sure if this covers all / and/or there is better way?
@drunken-monkey @mkalkbrenner any hints? Suggestions.
With this change i have back indexing. Both Search API Solr provided DataType and also our own custom ones (some still using Doctrine annotations).
Thanks
Comment #3
diegopino commented