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.
While search_api allows you to export index and server definitions through Features (via Entity API), these are not enough to get a Sarnia index running.
You also need to be able to export the "sarnia_entity_type" configuration for the index.
Attached is a patch that makes "sarnia_entity_type" exportable with cTools and a features hook to ensure that the entity_type is exported with a sarnia index and vice versa.
There's no manual export UI but that could be added if people were interested.
Comment | File | Size | Author |
---|---|---|---|
#12 | 1944430-sarnia_export_entities-12.patch | 799 bytes | jmdeleon |
#11 | 1944430-sarnia_export_entities-11.patch | 579 bytes | jmdeleon |
#8 | 1944430-sarnia_export_entities-8.patch | 1.72 KB | jmdeleon |
#4 | 1944430-sarnia_features_export.patch | 459 bytes | ZeiP |
sarnia_features.patch | 1.64 KB | krlucas | |
Comments
Comment #1
krlucas CreditAttribution: krlucas commentedComment #2
jmdeleon CreditAttribution: jmdeleon commentedTested this patch. Highly useful for Features export.
Comment #3
ZeiP CreditAttribution: ZeiP at Avoltus Oy for City of Turku commentedThe patch already seems to be applied in 7.x-1.x VCS branch since May 5th, 2015.
Comment #4
ZeiP CreditAttribution: ZeiP at Avoltus Oy for City of Turku commentedImporting the search index didn't work properly for me with the patch (or the latest VCS version). The default callback name in the above patch is probably wrong, but that didn't seem to fix it for me in the end either. Attached is a patch proposal for the change anyway.
I'll probably try to dig in to the problem later. I wonder if the Features support still needs to add the field type also; sarnia_entity_type_save() adds it but when I added the entity type straight to database it was missing.
Comment #5
jmdeleon CreditAttribution: jmdeleon commentedThe description of the patch states that server and index definitions export is handled by Search API, not this module.
I did find another issue with this patch, in that when multiple Sarnia Entity types are attempted to be exported, only one of the entities is written to the feature. This patch provides the rudimentary Features export support (hence why it was committed), but is the reasoning behind why this issue was left at Needs Work.
Comment #6
StephenN CreditAttribution: StephenN commentedI have tested with both attached patches and the latest 7.x-1.1-beta5 version of this module and have been unable to successfully deploy a sarnia index using features.
In my feature I included the sarnia server, sarnia index, sarnia entity type & the solr_document field base and instance. On enabling or reverting the feature via drush I get several instances of the following error.
SearchApiException: Unknown or invalid item type sarnia_sarnia. in search_api_get_datasource_controller() (line 1904 of /Users/stephenn/Documents/workspace/yiddishbookcenter.org/docroot/sites/all/modules/contrib/search_api/search_api.module)
On closer inspection the sarnia_entity_type table exists but is empty. An attempted workaround of adding a .install file to the feature that pre-populated the sarnia_entity_type table did not remove the errors, or lead to a working index.
Current manual workaround is as follows: Remove the index and entity type from the feature. Run a deployment enabling the feature. Log in and manually set the entity type on the sarnia tab of the server admin page. Revert the feature. This only needs to be done when first creating the index, after that features will function as normal.
Comment #7
ZeiP CreditAttribution: ZeiP at Avoltus Oy for City of Turku commentedIn the end I got Sarnia enabled in a feature by doing this:
The Sarnia feature contains the views, Search API server and index related to Sarnia. This worked for us, although I think it required also a specific order for updb & fra -y.
It'd be nice if exporting Sarnia configuration to a feature would be a ”bit” easier... :)
Comment #8
jmdeleon CreditAttribution: jmdeleon commentedThe issue I am seeing is that the dependent generated Sarnia entity is not being selected correctly when a Sarnia index was selected. Nor was the reverse case happening correctly (the generated Sarnia index selected along with the created Sarnia entity). The original submitted patch from krlucas claimed to accomplish this but was not working for me. Attached here is a fix for his patch that did work for me.
I was able to verify from the generated feature code that the entity and the index exports were in the resulting feature.
Comment #9
jmdeleon CreditAttribution: jmdeleon commentedComment #10
jmdeleon CreditAttribution: jmdeleon commentedComment #11
jmdeleon CreditAttribution: jmdeleon commentedHere's a simplified version of the patch in #8...
Comment #12
jmdeleon CreditAttribution: jmdeleon commentedSmall addendum to the patch in #11, to remove a maddening little typo in the comments :)
Comment #14
jmdeleon CreditAttribution: jmdeleon commented