Closed latonv closed 1 year ago
Merging #16 (e6e1e83) into main (bfbb495) will increase coverage by
4.54%
. The diff coverage is85.99%
.:exclamation: 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%) |
:arrow_up: |
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.
starting code review...
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 rathersearchService.search(params, SearchType.METADATA)
orsearchService.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) andtext
(from Full Text searches). These are modeled under/src/models/hit-types
. These hits are modeled similarly to the existingMetadata
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
andfetchMetadataValue
methods will need to migrate to this new dependency before upgrading to the new search service.