Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
search_api_solr_shards
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
search_api_solr_shards
Commits
77cf1321
Commit
77cf1321
authored
1 year ago
by
Daniel Cimorra
Browse files
Options
Downloads
Patches
Plain Diff
feat: allow the URL of the shard to be overwritten
Refs:
#3388738
parent
08092959
No related branches found
No related tags found
1 merge request
!2
feat: allow the URL of the shard to be overwritten
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Plugin/search_api/datasource/ShardDocument.php
+5
-5
5 additions, 5 deletions
src/Plugin/search_api/datasource/ShardDocument.php
src/ShardFieldManager.php
+9
-5
9 additions, 5 deletions
src/ShardFieldManager.php
with
14 additions
and
10 deletions
src/Plugin/search_api/datasource/ShardDocument.php
+
5
−
5
View file @
77cf1321
...
...
@@ -34,11 +34,11 @@ class ShardDocument extends SolrDocument {
'#title'
=>
$this
->
t
(
'Solrconfig.xml file'
),
'#description'
=>
$this
->
t
(
'The file from which the shard property will be read'
),
];
$form
[
'
instance
_url'
]
=
[
'#type'
=>
'
textfield
'
,
'#default_value'
=>
$this
->
configuration
[
'
instance
_url'
],
'#title'
=>
$this
->
t
(
'
URL variable
.'
),
'#description'
=>
$this
->
t
(
'
Replacement variable for the URL of the solr instance
'
),
$form
[
'
override_shard
_url'
]
=
[
'#type'
=>
'
checkbox
'
,
'#default_value'
=>
$this
->
configuration
[
'
override_shard
_url'
],
'#title'
=>
$this
->
t
(
'
Override shard URL
.'
),
'#description'
=>
$this
->
t
(
'
If the shard URL is a substitution variable (like ${solr.instance.url}), it is necessary to overwrite it in order to prevent each of the configured instances from being inaccessible.
'
),
];
return
$form
+
parent
::
buildConfigurationForm
(
$form
,
$form_state
);
...
...
This diff is collapsed.
Click to expand it.
src/ShardFieldManager.php
+
9
−
5
View file @
77cf1321
...
...
@@ -110,13 +110,17 @@ class ShardFieldManager extends SolrFieldManager {
return
NULL
;
}
protected
function
getInstanceUrl
(
IndexInterface
$index
)
{
protected
function
shardIsOverriden
(
IndexInterface
$index
)
{
if
(
$index
->
getDatasources
())
{
return
$index
->
getDatasource
(
'solr_document'
)
->
getConfiguration
()[
'instance_url'
];
$configuration
=
$index
->
getDatasource
(
'solr_document'
)
->
getConfiguration
();
if
(
isset
(
$configuration
[
'override_shard_url'
]))
{
return
(
bool
)
$configuration
[
'override_shard_url'
];
}
}
return
NULL
;
return
FALSE
;
}
/**
...
...
@@ -136,7 +140,7 @@ class ShardFieldManager extends SolrFieldManager {
$shards
=
$this
->
getShardServers
(
$index
);
$server
=
$index
->
getServerInstance
();
if
(
$this
->
getInstanceUrl
(
$index
)
!==
NULL
)
{
if
(
$this
->
shardIsOverriden
(
$index
)
!==
FALSE
)
{
$config
=
$index
->
getServerInstance
()
->
getBackend
()
->
getConfiguration
()[
'connector_config'
];
foreach
(
$shards
as
$key
=>
$shard
)
{
$parsed
=
parse_url
(
$shard
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment