Skip to content

Commit

Permalink
#718: Add desired taxonomy data on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
jebbdomingo committed Nov 12, 2024
1 parent 1a6f456 commit 903cc8f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions code/libraries/joomlatools/plugin/koowa/finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ abstract class PlgKoowaFinder extends FinderIndexerAdapter
*/
protected $instructions = array();

/**
* Array of taxonomy terms. These are used to tell the indexer to add taxonomy terms of the entities in the research result
*
* @var array
*/
protected $taxonomies = array();

/**
* Constructor
*
Expand Down Expand Up @@ -191,6 +198,11 @@ protected function index(FinderIndexerResult $item)
}
}

// Add taxonomies
foreach ($this->taxonomies AS $type => $taxonomy) {
$item->addTaxonomy($type, $taxonomy);
}

// Add the type taxonomy data.
$item->addTaxonomy('Type', $this->type_title);

Expand Down Expand Up @@ -368,9 +380,6 @@ protected function getFinderItem(KModelEntityInterface $entity)

if ($entity->isCreatable())
{
// Add the author taxonomy data.
$item->addTaxonomy('Author', $entity->getAuthor()->getName());

// Add the start date
$item->start_date = $entity->created_on;
}
Expand Down

0 comments on commit 903cc8f

Please sign in to comment.