Islandora / controlled_access_terms

Drupal module for subject and agents
GNU General Public License v2.0
7 stars 28 forks source link

Replace "Linked Agent By Role" - new Plugin for filtering Typed Relations in search API #89

Closed rosiel closed 3 months ago

rosiel commented 1 year ago

What does this Pull Request do?

Creates new "fields" (in search api) for your Typed Relation fields. You can filter what relation types get included.

This does the same thing as the Linked Agent By Role plugin on the Islandora Install Profile Demo, except without the hard-coding and without cluttering the Search API field with 271 different fields.

What's new?

New Search API Processor plugin!

Selecting the new field Configuring the new field

How should this be tested?

A description of what steps someone could take to:

Additional Notes:

Any additional information that you think would be helpful when reviewing this PR.

Interested parties

Tag (@ mention) interested parties or, if unsure, @Islandora/committers

rosiel commented 1 year ago

Can be tested, feedback welcome.

I'm going to try to move these fields out of search api's "General" section, and into the individual sections for "Content", "Media", etc.

rosiel commented 1 year ago

With the last commit, the fields no longer show in "General" but in the appropriate "datasource" (i.e. Content, Taxonomy Term, etc... they show up with their partner fields.)

If you already had started testing before this commit, you need to remove existing fields of this type, and clear the index and "rebuild tracking information". I had trouble because it had cached the old (invalid) field definition.

Screen Shot 2022-11-23 at 10 00 22 PM
simonhm commented 1 year ago

@rosiel We're testing this patch, and unfortunately this's not working as intended. After patching this PR, new search API processor is showed up. I enabled it and was able to add new field Linked Agent (filtered by type) as same as your instruction. Then when I re-index, I got the below messages in Recent Logs:

`Notice: Undefined index: bundle in Drupal\controlled_access_terms\Plugin\search_api\processor\TypedRelationFiltered->addFieldValues() (line 137 of /var/www/html/drupal/web/modules/contrib/controlled_access_terms/src/Plugin/search_api/processor/TypedRelationFiltered.php)

0 /var/www/html/drupal/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(8, 'Undefined index...', '/var/www/html/d...', 137)

1 /var/www/html/drupal/web/modules/contrib/controlled_access_terms/src/Plugin/search_api/processor/TypedRelationFiltered.php(137): _drupal_error_handler(8, 'Undefined index...', '/var/www/html/d...', 137, Array) ...`

And the facet for this new field is not displaying/working as intended after I do a search. Simon.

rosiel commented 1 year ago

Thank you so much! I think I've fixed that now.

jordandukart commented 1 year ago

Configuration schema changes here are the same as in https://github.com/Islandora/islandora/pull/913#discussion_r1089461386. I think we may be able to re-work how these are constructed. I may give this a go and update this further.

seth-shaw-asu commented 11 months ago

@jordandukart, were you able to re-work the configuration schema changes as mentioned in https://github.com/Islandora/controlled_access_terms/pull/89#issuecomment-1426021950, or should we move forward with testing and merging?

wgilling commented 10 months ago

I will add "review this" PR to my to-do list for this week sometime.

wgilling commented 10 months ago

I must have something in my local "bd-isle" project that is interfering with seeing these. Would I be able to see the "Linked Agent (filtered by type) [islandora] typed_relation_filternodeislandora_object_field_linked_agent" on the Solr index | Fields page https://islandora.traefik.me/admin/config/search/search-api/index/default_solr_index/fields?

image

rosiel commented 10 months ago

You might have to enable it first, under the "Processors" tab.

wgilling commented 10 months ago

Linked Agent by Type "adds the item's linked agent separately by type" was checked. This is probably conflicting with something in the bd-isle flavor site I pulled this feature branch of controlled access terms into. How do I spin up a vanilla islandora site?