Skip to content

Commit

Permalink
Merge pull request #2300 from LD4P/fix-search-total
Browse files Browse the repository at this point in the history
Search result updates for Elasticsearch Upgrade
  • Loading branch information
jermnelson authored Jul 20, 2020
2 parents 6f3ba8d + 08e857a commit 56d19a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions __tests__/sinopiaSearch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('getSearchResults', () => {
failed: 0,
},
hits: {
total: 2,
total: { value: 2 },
max_score: 0.2876821,
hits: [{
_index: 'sinopia_resources',
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('getSearchResultsWithFacets', () => {
failed: 0,
},
hits: {
total: 2,
total: { value: 2 },
max_score: 1,
hits: [
{
Expand Down Expand Up @@ -380,7 +380,7 @@ describe('getLookupResults', () => {
failed: 0,
},
hits: {
total: 0,
total: { value: 0 },
max_score: null,
hits: [],
},
Expand All @@ -396,7 +396,7 @@ describe('getLookupResults', () => {
failed: 0,
},
hits: {
total: 1,
total: { value: 1 },
max_score: 0.53412557,
hits: [
{
Expand Down
4 changes: 2 additions & 2 deletions src/sinopiaSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const getSearchResultsWithFacets = async (query, options = {}) => {

const hitsToResult = (hits) => (
{
totalHits: hits.total,
totalHits: hits.total.value,
results: hits.hits.map((row) => ({
uri: row._source.uri,
label: row._source.label,
Expand Down Expand Up @@ -159,7 +159,7 @@ export const getTemplateSearchResults = async (query, options = {}) => {
}
}
return {
totalHits: json.hits.total,
totalHits: json.hits.total.value,
results: json.hits.hits.map((row) => row._source),
error: undefined,
}
Expand Down

0 comments on commit 56d19a1

Please sign in to comment.