Skip to content

Commit

Permalink
feat: remove some translation properties from the search list and col…
Browse files Browse the repository at this point in the history
…umns, allow to search for readonly props
  • Loading branch information
shpran committed Nov 15, 2024
1 parent f7f9bc4 commit c8f39ad
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion model/Metadata/Service/AdvancedSearchSettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@
use oat\tao\model\search\Contract\SearchSettingsServiceInterface;
use oat\tao\model\search\ResultColumn;
use oat\tao\model\search\SearchSettings;
use oat\tao\model\TaoOntology;

class AdvancedSearchSettingsService implements SearchSettingsServiceInterface
{
private const OMIT_PROPERTIES = [
OntologyRdfs::RDFS_LABEL
OntologyRdfs::RDFS_LABEL,
TaoOntology::PROPERTY_TRANSLATION_TYPE,
TaoOntology::PROPERTY_TRANSLATION_PROGRESS,
TaoOntology::PROPERTY_TRANSLATION_ORIGINAL_RESOURCE_URI,
];

public const DEFAULT_SORT_COLUMN = 'label.raw';
Expand Down
10 changes: 9 additions & 1 deletion model/Metadata/Service/ClassMetadataSearcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,20 @@
use oat\tao\model\Lists\Business\Service\GetClassMetadataValuesService;
use oat\tao\model\search\ResultSet;
use oat\tao\model\search\SearchProxy;
use oat\tao\model\TaoOntology;
use oat\taoAdvancedSearch\model\SearchEngine\Driver\Elasticsearch\ElasticSearch;
use oat\taoAdvancedSearch\model\SearchEngine\Query;

class ClassMetadataSearcher extends ConfigurableService implements ClassMetadataSearcherInterface
{
private const BASE_LIST_ITEMS_URI = '/tao/PropertyValues/get?propertyUri=%s';

private const UNACCEPTABLE_PROPERTIES = [
TaoOntology::PROPERTY_TRANSLATION_TYPE,
TaoOntology::PROPERTY_TRANSLATION_PROGRESS,
TaoOntology::PROPERTY_TRANSLATION_ORIGINAL_RESOURCE_URI,
];

use OntologyAwareTrait;

public function findAll(ClassMetadataSearchInput $input): ClassCollection
Expand Down Expand Up @@ -89,8 +96,9 @@ private function getProperties(string $classUri): array
$allProperties = [$result];
$allProperties = $this->getRelatedProperties($result, $allProperties);
$allProperties = $this->getClassPathProperties($classUri, $allProperties);
$allProperties = $this->filterDuplicatedProperties($allProperties);

return $this->filterDuplicatedProperties($allProperties);
return array_diff_key($allProperties, array_flip(self::UNACCEPTABLE_PROPERTIES));
}

private function getClassPathProperties(string $classUri, array $allProperties): array
Expand Down
1 change: 1 addition & 0 deletions model/SearchEngine/Driver/Elasticsearch/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class QueryBuilder
'RadioBox',
'SearchTextBox',
'SearchDropdown',
'Readonly',
];

private const LOGIC_MODIFIERS = [
Expand Down

0 comments on commit c8f39ad

Please sign in to comment.