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

WEBDEV-5328 Integrate search service with beta search backend #16

Merged
merged 112 commits into from
Sep 22, 2022

Conversation

latonv
Copy link
Contributor

@latonv latonv commented Aug 30, 2022

This PR overhauls the internals of the search service to point at the beta Page Production Service (PPS) instead of the advanced_search.php endpoint. Unlike in the old version of this service, different search types can be requested which are mapped to different backends as needed. As a result, the client-facing search call is no longer searchService.search(params), but rather searchService.search(params, SearchType.METADATA) or searchService.search(params, SearchType.FULLTEXT). This can be extended to additional search types/backends in the future. Clients will determine the appropriate search type depending on user preference or other factors.

The PPS responses are structured differently than the ones from advanced_search.php, necessitating many changes to how the raw responses are mapped to our models. These changes occur largely in the /src/responses/* classes.

In particular, the PPS may return different types of search "hits" each conforming to their own schema. The two currently-implemented hit types are item (from Metadata searches) and text (from Full Text searches). These are modeled under /src/models/hit-types. These hits are modeled similarly to the existing Metadata class, with readonly optional fields to reflect the fact that most metadata fields are not guaranteed to be present on the hits, and the client should not make undue assumptions about whether a given field is defined.

In keeping with this, the Hit interface presented within client-facing responses is agnostic of exactly which type of hit was returned -- though clients may determine this from the returned hit schema if necessary (e.g., if rendering details differ depending on the type of hits returned).

Lastly, the previous version of the search service had additional methods for fetching all metadata for a single item. This PR removes this functionality entirely as it has been moved to the iaux-metadata-service package for a cleaner separation of responsibilities. Clients that rely on the fetchMetadata and fetchMetadataValue methods will need to migrate to this new dependency before upgrading to the new search service.

@codecov
Copy link

codecov bot commented Sep 1, 2022

Codecov Report

Merging #16 (e6e1e83) into main (bfbb495) will increase coverage by 4.54%.
The diff coverage is 85.99%.

❗ Current head e6e1e83 differs from pull request most recent head e500ab9. Consider uploading reports for the commit e500ab9 to get more accurate results

@@            Coverage Diff             @@
##             main      #16      +/-   ##
==========================================
+ Coverage   75.35%   79.90%   +4.54%     
==========================================
  Files          20       24       +4     
  Lines        1331     1891     +560     
  Branches       26      118      +92     
==========================================
+ Hits         1003     1511     +508     
- Misses        326      374      +48     
- Partials        2        6       +4     
Impacted Files Coverage Δ
src/models/metadata.ts 50.76% <0.00%> (+0.22%) ⬆️
src/models/aggregation.ts 69.79% <62.33%> (ø)
src/responses/search-response.ts 94.23% <80.00%> (ø)
src/models/hit-types/text-hit.ts 80.90% <80.90%> (ø)
src/responses/search-response-details.ts 85.00% <85.00%> (ø)
src/models/hit-types/item-hit.ts 86.19% <86.19%> (ø)
src/search-backend/base-search-backend.ts 84.86% <97.87%> (ø)
src/responses/search-request.ts 100.00% <100.00%> (ø)
src/search-backend/fulltext-search-backend.ts 100.00% <100.00%> (ø)
src/search-backend/metadata-search-backend.ts 100.00% <100.00%> (ø)
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@latonv latonv merged commit 5720d85 into main Sep 22, 2022
@latonv latonv deleted the fts-integration branch September 22, 2022 22:24
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.

None yet

3 participants