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

Restored highlighting of title in search results #1973

Merged
merged 10 commits into from
Jan 11, 2023

Conversation

corrad82-4s
Copy link
Contributor

@corrad82-4s corrad82-4s commented Nov 21, 2022

References

Description

Short summary of changes (1-2 sentences).
Title metadata value in search results list is filled using firstMetadataValue function, taking into account parts to be highlighted, if any.

Instructions for Reviewers

Please add a more detailed description of the changes made by your PR. At a minimum, providing a bulleted list of changes in your PR is helpful to reviewers.

List of changes in this PR:

  • item-search-result-list-element-component updated to use firstMetadataValue

Include guidance for how to test or review your PR. This may include: steps to reproduce a bug, screenshots or description of a new feature, or reasons behind specific changes.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes TSLint validation using yarn run lint
  • My PR doesn't introduce circular dependencies
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new, third-party dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.

@tdonohue tdonohue added improvement component: Discovery related to discovery search or browse system 1 APPROVAL pull request only requires a single approval to merge bug and removed improvement labels Nov 28, 2022
@tdonohue tdonohue added this to the 7.5 milestone Nov 28, 2022
@tdonohue tdonohue self-requested a review December 1, 2022 15:41
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

@corrad82-4s & @nikunj59: Finally tested this today. This works, but only for Items and Publication Entities. If the search result is any other type of Entity (e.g. Journal, Project, OrgUnit or Person) or is a Community or Collection, then the title highlighting still does not occur. For example, try searching for a person's last name and the Person Entity won't have its title highlighted. Or, try searching for a term in a Journal title, and again highlighting will not occur for a matching Journal Entity. Or search on a Collection title, and you'll see the Collection's title will not be highlighted in the results.

So, this appears to only be a partial fix. I think the issue may be in the dsoTitle (which seems to be used as the title of all objects in search results). By default that dsoTitle just get the name of the object, but in this scenario maybe there's a way we can dynamically update it to use the firstMetadataValue('dc.title')?? I admit though that I'm not sure how plausible that would be... I'm just pointing out that if you can fix dsoTitle directly, then it may fix this issue for all objects.

…gUnit or Person) or is a Community or Collection
@nikunj59
Copy link
Contributor

nikunj59 commented Dec 19, 2022

@tdonohue as Per your suggestion, updated changes: 247e61c

@corrad82-4s
Copy link
Contributor Author

This PR has been updated with latest requested changes

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

@corrad82-4s and @nikunj59 : Re-tested this today. The behavior is better, but it's still not working for OrgUnits & Person Entities. I did notice those are the only two Entity Types where you switched away from using dsoTitle. Could that be the reason these don't work?

I have verified though that Community/Collection/Project/Journal/Journal Issue/Journal Volume/Publication/Item all work. It's just down to the last two entities.

@nikunj59
Copy link
Contributor

@tdonohue
can you please check if those orgUnits and person entities have hitHighlights from BE response?
I tested in local and its working fine with my person data.
Screenshot 2022-12-16 at 6 57 26 PM

In orgUnit dont have hitHighlights:
Screenshot 2022-12-16 at 7 01 14 PM

@tdonohue
Copy link
Member

tdonohue commented Dec 20, 2022

@nikunj59 : When searching Person Entities, I see the behavior in your first screenshot. If you look closely, the first person in your screenshot above should have hit highlighting. You searched on "test" and somehow it didn't highlight "Test, Test" (the first person in your list). If I similarly search on a Person's last name or first name, I cannot get hit highlighting to appear.
no-name-highlight
no-firstname-highlight

I can verify that in the REST API response, the hitHighlights are always null in these scenarios. So, it appears this PR may be all the fixes that are needed on the frontend. But we obviously still have bugs on the backend for Person and OrgUnit entities.

So, I can move this PR forward as-is. However, do you or @corrad82-4s plan to fix these backend bugs? Or should we create a new ticket to clarify that know issues with hit highlighting still occur for Person and OrgUnit entities?

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

👍 Changing my vote to a +1. This PR appears to have fixed the issues on the frontend.

However, Person and OrgUnit entities still do not show hit highlighting in the Name/Title field. This appears to be a backend issue though as the hitHighlights in the REST response is always null.

So, this fixes the frontend bug, but some known issues still remain.

@corrad82-4s
Copy link
Contributor Author

@tdonohue : we are checking the backend issue. The cause seems to be a missing configuration. We are testing this updated configuration with this development. Once are tests will be run, we will update you through this PR

@nikunj59
Copy link
Contributor

nikunj59 commented Jan 6, 2023

@corrad82-4s @tdonohue
As per My investigation
For Person it comes in highlights as person.familyName, person.givenName with html tags.
For OrgUnit it comes in highlights as organization.legalName with html tags.
But we are using to highlight title this.firstMetadataValue('dc.title')

Screenshot 2023-01-05 at 7 55 20 PM
Screenshot 2023-01-05 at 7 49 46 PM

@tdonohue
Copy link
Member

tdonohue commented Jan 6, 2023

@nikunj59 and @corrad82-4s : As the hit highlights are coming through on a different metadata field, that implies that this PR may need to not assume that the highlighted field is always dc.title. The fields that are receiving hit highlights for Person and OrgUnit are the same fields which the DSONameService uses to display Person & OrgUnit names: https://github.com/DSpace/dspace-angular/blob/main/src/app/core/breadcrumbs/dso-name.service.ts#L28-L42

Maybe this PR should be refactored to somehow use DSONameService instead of only using the dc.title field?? Otherwise, it seems like hit highlighting will never work for objects which do not use dc.title.

I'm going to leave this PR open until you have a chance to reanalyze whether there's a way to refactor to use DSONameService. I suspect there should be, but I do realize it may take some closer analysis.

@nikunj59
Copy link
Contributor

nikunj59 commented Jan 9, 2023

@tdonohue
Thanks for clarification.
I'll cover responded field for Person and OrgUnit and refactor pull request.

@nikunj59
Copy link
Contributor

nikunj59 commented Jan 9, 2023

@tdonohue
in DSONameService factory you mentioned will return plain title because on the dso object which its processing is indexableObject.
https://github.com/DSpace/dspace-angular/blob/main/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.ts#L35-L36

@corrad82-4s
Copy link
Contributor Author

Hi @tdonohue ,
we have pushed latest required changes. A further REST PR (DSpace/DSpace#8626) has been created to enable hightlighting for Person and OrgUnits.

@nikunj59
Copy link
Contributor

nikunj59 commented Jan 10, 2023

@tdonohue tdonohue self-requested a review January 11, 2023 22:06
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

👍 Thanks @nikunj59 and @corrad82-4s ! This works well now, and I appreciate that the logic has all moved into dso-name.service.ts alongside the getName() method there.

I was able to verify that all object types & all entity types now show hit highlighting in the displayed title/name.

@tdonohue tdonohue merged commit 793bed3 into DSpace:main Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug component: Discovery related to discovery search or browse system
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Missing highlights in title in search results
3 participants