Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Searchable Entity Formatter. #45

Merged
merged 1 commit into from
May 22, 2024
Merged

Conversation

rosiel
Copy link
Member

@rosiel rosiel commented Mar 30, 2024

What does this Pull Request do?

Copies the Searchable Entity Formatter from ASULibraries. This allows us to set up node display so that taxonomy terms are links to a facet search for that term, rather than links to the taxonomy term's page.

I'm grouping it in Advanced Search because I believe that the facet selection (e.g. f[0]) is related to the way that advanced search processes queries.

  • Related GitHub Issue: (link)

  • Other Relevant Links: (Google Groups discussion, related pull requests,
    Release pull requests, etc.)

What's new?

A lovely new field formatter called "Searchable Entity Formatter" lets you make related entities show up as links to facet searches for that entity's label.

How should this be tested?

To set up:

  • set up your site with this PR
  • Get some content in your site that uses taxonomy terms (as a baseline you can test with islandora model)
  • Make sure that taxonomy term field is indexed in solr as a string.
  • Set up a facet that uses that solr field. take note of the "URL Alias" setting.
  • Go to Structure > Content Types > Repository Item > Manage Display and find your field. Set the formatter to "Searchable Entity Formatter". Configure the searchable entity formatter to use the facet's URL alias as the "Search variable". Select "Use label as search term"
  • Go back to the site and view a node. The taxonomy term you set up should now be a search link.

Documentation Status

  • Does this change existing behaviour that's currently documented? no
  • Does this change require new pages or sections of documentation? documented in readme.
  • Who does this need to be documented for? site managers
  • Associated documentation pull request(s): _n/a or documentation issue _n/a

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
Copy link
Member Author

rosiel commented Apr 4, 2024

Maybe we don't need this, if we use this (one-person, not-frequently-updated) module (with a warning on its page about what sounds like a serious bug, which may not be applicable anymore).
Entity Reference Facet Link

@Natkeeran
Copy link
Contributor

Natkeeran commented Apr 10, 2024

@rosiel
Tested this PR.

Not quite working as expected for me.

The starter site has subjects facet setup: subjects (admin/config/search/facets/subjects/edit).

Configured the subject field formatter as below:

Search base path: search?f[0]
Search variable: subjects
Use label as search term: checked

When I go to an item with the subject (e.g node/5), it redirects as: https://islandora.traefik.me/node/5?f%5B0%5D=subjects%3Amath

I was expecting it to redirect to https://islandora.traefik.me/search?f%5B0%5D=subject%3Amath

@rosiel
Copy link
Member Author

rosiel commented Apr 24, 2024

If you change the setting to /search?[0] does it work? if so, I can make the change in the default.

@aOelschlager aOelschlager self-requested a review May 1, 2024 17:12
Copy link
Contributor

@aOelschlager aOelschlager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked for me. I went to admin/structure/types/manage/islandora_object/display and selected the formatter for entities that had facets (wsod when viewing objects if there isn't a facet for that entity.) I also created just a facet (indexed first in solr but had no sidebar block) for one of the taxonomy vocabularies and the formatter worked with that as well.

Screenshot from 2024-05-09 12-17-20
My mouse was hovering over the link but it doesn't show up in the screenshot
Screenshot from 2024-05-09 12-18-53

Screenshot from 2024-05-09 12-21-36

@Natkeeran Natkeeran merged commit 5186018 into Islandora:2.x May 22, 2024
@rosiel rosiel deleted the search-formatter branch May 22, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants