Skip to content

Commit

Permalink
Merge pull request #315 from effective-webwork/issue-1959-2
Browse files Browse the repository at this point in the history
#1959: Extended search: Make publication identifiers searchable.
  • Loading branch information
Erikmitk authored Dec 22, 2024
2 parents c93e353 + f1b154a commit 43d4094
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Classes/Configuration/ClientConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ public function getAdditionalSearchTitleXpaths()
return $this->getSetting("additionalSearchTitleXpaths");
}

public function getAdditionalIdentifierXpaths()
{
return $this->getSetting("additionalIdentifierXpaths");
}

public function getNamespaces()
{
return $this->getSetting("namespaces");
Expand Down
15 changes: 15 additions & 0 deletions Classes/Domain/Model/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,11 @@ class Client extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $additionalSearchTitleXpaths = '';

/**
* @var string
*/
protected $additionalIdentifierXpaths = '';

/**
* Returns the project
*
Expand Down Expand Up @@ -2569,4 +2574,14 @@ public function setAdditionalSearchTitleXpaths(string $additionalSearchTitleXpat
{
$this->additionalSearchTitleXpaths = $additionalSearchTitleXpaths;
}

public function getAdditionalIdentifierXpaths(): string
{
return $this->additionalIdentifierXpaths;
}

public function setIdentifierXpaths(string $additionalIdentifierXpaths): void
{
$this->additionalIdentifierXpaths = $additionalIdentifierXpaths;
}
}
24 changes: 24 additions & 0 deletions Classes/Services/Api/InternalFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,30 @@ public function getSearchTitles(): array
return $values;
}

/**
* @return array
*/
public function getSearchIdentifiers(): array
{
$additionalIdentifierXpaths = $this->clientConfigurationManager->getAdditionalIdentifierXpaths();
$additionalIdentifierXpathList = explode(";", trim($additionalIdentifierXpaths, " ;"));
$xpath = $this->getXpath();
$values = [];

foreach ($additionalIdentifierXpathList as $additionalIdentifierXpathItem) {
if (empty($additionalIdentifierXpathItem)) continue;

$elements = $xpath->query(self::rootNode . trim($additionalIdentifierXpathItem));

if ($elements) foreach ($elements as $element) {
$values[] = trim($element->nodeValue);
}
}

return $values;
}


/**
* @return array
*/
Expand Down
4 changes: 4 additions & 0 deletions Classes/Services/ElasticSearch/ElasticSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ public function index(Document $document, $refresh = 'wait_for')
$data->identifier[] = $document->getObjectIdentifier();
$data->identifier[] = $document->getProcessNumber();

foreach ($internalFormat->getSearchIdentifiers() as $searchIdentifier) {
$data->identifier[] = $searchIdentifier;
}

if ($document->getCreator()) {
$data->creator = $document->getCreator();
} else {
Expand Down
20 changes: 18 additions & 2 deletions Configuration/TCA/tx_dpf_domain_model_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
text_type_xpath, open_access_xpath,
peer_review_xpath, peer_review_other_version_xpath, license_xpath, validation_xpath,
date_issued_xpath, framework_agreement_id_xpath, search_year_xpaths, publisher_xpaths,
project_id_xpath, project_title_xpath','additional_search_title_xpaths',
project_id_xpath, project_title_xpath, additional_search_title_xpaths, additional_identifier_xpaths',
'iconfile' => 'EXT:dpf/Resources/Public/Icons/default.gif',
),
'interface' => array(
Expand Down Expand Up @@ -96,7 +96,7 @@
text_type_xpath, open_access_xpath,
peer_review_xpath, peer_review_other_version_xpath, license_xpath, validation_xpath,
date_issued_xpath, framework_agreement_id_xpath, search_year_xpaths, publisher_xpaths,
project_id_xpath, project_title_xpath, additional_search_title_xpaths'
project_id_xpath, project_title_xpath, additional_search_title_xpaths, additional_identifier_xpaths'
),
'types' => array(
'1' => array('showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, --palette--;;1,
Expand All @@ -121,6 +121,7 @@
--pallette--;;pallette_project_id_xpath,
--pallette--;;pallette_project_title_xpath,
--pallette--;;pallette_additional_search_title_xpaths,
--pallette--;;pallette_additional_identifier_xpaths,
--div--;Fedora, fedora_host, fedora_user, fedora_password, fedora_endpoint, fedora_root_container, fedora_collection_namespace,
--div--;Elastic search, elastic_search_host, elastic_search_port, elastic_search_index_name,
--div--;Upload, upload_directory, upload_domain,
Expand Down Expand Up @@ -193,6 +194,10 @@
'label' => 'LLL:EXT:dpf/Resources/Private/Language/locallang_db.xlf:tx_dpf_domain_model_client.search_field_xml.additional_search_title.label',
'showitem' => 'additional_search_title_xpaths'
),
'pallette_additional_identifier_xpaths' => array(
'label' => 'LLL:EXT:dpf/Resources/Private/Language/locallang_db.xlf:tx_dpf_domain_model_client.search_field_xml.additional_identifiers.label',
'showitem' => 'additional_identifier_xpaths'
),
),
'columns' => array(
'sys_language_uid' => array(
Expand Down Expand Up @@ -1461,5 +1466,16 @@
'eval' => 'trim',
),
),
'additional_identifier_xpaths' => array(
'exclude' => 1,
'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dpf/Resources/Private/Language/locallang_db.xlf:tx_dpf_domain_model_client.search_field_xml.additional_identifiers.xpath',
'config' => array(
'type' => 'text',
'cols' => 80,
'rows' => 10,
'eval' => 'trim',
),
),
),
);
8 changes: 8 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,14 @@
<source>XPath expressions for additional titles (Multiple Xpath expressions can be concatenated using ';')</source>
<target>XPath-Ausdrücke für zusätzliche Titel(Mehrere XPath-Ausdrücke können mit „;“ verkettet werden)</target>
</trans-unit>
<trans-unit id="tx_dpf_domain_model_client.search_field_xml.additional_identifiers.label" approved="yes">
<source>Additional identifiers</source>
<target>Zusätzliche Identifikatoren</target>
</trans-unit>
<trans-unit id="tx_dpf_domain_model_client.search_field_xml.additional_identifiers.xpath" approved="yes">
<source>XPath expressions for additional identifiers (Multiple Xpath expressions can be concatenated using ';')</source>
<target>XPath-Ausdrücke für zusätzliche Identifikatoren(Mehrere XPath-Ausdrücke können mit „;“ verkettet werden)</target>
</trans-unit>
</body>
</file>
</xliff>
6 changes: 6 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,12 @@
</trans-unit>
<trans-unit id="tx_dpf_domain_model_client.search_field_xml.additional_search_title.xpath" approved="yes">
<source>XPath expressions for additional title information (Multiple Xpath expressions can be concatenated using ';')</source>
</trans-unit>
<trans-unit id="tx_dpf_domain_model_client.search_field_xml.additional_identifiers.label" approved="yes">
<source>Additional identifiers</source>
</trans-unit>
<trans-unit id="tx_dpf_domain_model_client.search_field_xml.additional_identifiers.xpath" approved="yes">
<source>XPath expressions for additional identifiers (Multiple Xpath expressions can be concatenated using ';')</source>
</trans-unit>
</body>
</file>
Expand Down
1 change: 1 addition & 0 deletions ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ CREATE TABLE tx_dpf_domain_model_client (
project_id_xpath tinytext NOT NULL,
project_title_xpath tinytext NOT NULL,
additional_search_title_xpaths text NOT NULL,
additional_identifier_xpaths text NOT NULL,

fis_collections tinytext NOT NULL,

Expand Down

0 comments on commit 43d4094

Please sign in to comment.