File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -91,15 +91,22 @@ DATABASE_URL=mysql://foo:bar@host:3306
9191The default Solr connection can be configured via a [ DSN] ( https://en.wikipedia.org/wiki/Data_source_name ) :
9292
9393``` dotenv
94- SOLR_URL=host:port
94+ SOLR_URL=http://localhost
9595```
9696
97- For example:
97+ This package makes several assumptions, which can be overridden via the ` SOLR_URL ` DSN. The DSN in the
98+ example above is automatically expanded to:
9899
99100``` dotenv
100- SOLR_URL=solr.foo.site: 8983
101+ SOLR_URL=http://default@localhost: 8983#default
101102```
102103
104+ In the expanded example above, the ` user ` is the name of the Solr core & the ` fragment ` is the Drupal machine
105+ name for the connection. Consider revising Solr core & Drupal Solr server machine names to ` default ` ,
106+ so the shorter DSN can be used.
107+
108+ Streamlined environment-dependent configuration of _ one_ Solr core is supported at this time.
109+
103110##### Supported Placeholders
104111* ` {{app_path}} ` : The path where Drupal is located.
105112* ` {{project_path}} ` : The path where the project is located.
Original file line number Diff line number Diff line change @@ -95,9 +95,13 @@ public function getConfig(): array
9595 $ config = [];
9696 if (isset ($ _SERVER ['SOLR_URL ' ])) {
9797 $ parts = parse_url ($ _SERVER ['SOLR_URL ' ]);
98- $ config ['search_api.server.afa_solr ' ]['backend_config ' ]['connector_config ' ] = [
99- 'host ' => $ parts ['host ' ],
100- 'port ' => $ parts ['port ' ],
98+ $ name = $ parts ['fragment ' ] ?? 'default ' ;
99+ $ config ['search_api.server. ' . $ name ]['backend_config ' ]['connector_config ' ] = [
100+ 'scheme ' => $ parts ['scheme ' ] ?? 'http ' ,
101+ 'host ' => $ parts ['host ' ] ?? 'localhost ' ,
102+ 'port ' => $ parts ['port ' ] ?? 8983 ,
103+ 'path ' => $ parts ['path ' ] ?? '/ ' ,
104+ 'core ' => $ parts ['user ' ] ?? 'default ' ,
101105 ];
102106 }
103107 switch ($ this ->getEnvironmentName ()) {
You can’t perform that action at this time.
0 commit comments