Skip to content

Commit

Permalink
Merge pull request #25 from Fgerthoffert/develop
Browse files Browse the repository at this point in the history
Fixed an issue in isIndexed
  • Loading branch information
Fgerthoffert authored Feb 1, 2020
2 parents 75b15ba + 47c56e1 commit 0c23ec7
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/components/search/check/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ import { sleep } from '../../../utils';
import gqlQuery from './gql';

const isIndexed = (data: any, hits: number) => {
if (data.data === undefined || data.data.jcr === undefined) {
return false;
}
if (data.data.jcr.searches.search.totalHits > 0) {
console.log('The search query returned ' + data.data.jcr.searches.search.totalHits + ' hits');
}
if (data.data.jcr.searches.search.totalHits < hits) {
return false;
if (data.data && data.data.jcr && data.data.jcr.searches && data.data.jcr.searches.search && data.data.jcr.searches.search.totalHits) {
const queryHits = data.data.jcr.searches.search.totalHits;
console.log('The search query returned ' + queryHits + ' hits');
if (Number.parseInt(queryHits, 10) >= hits) {
return true;
}
}
return true;
return false;
};

/* eslint max-params: ["error", 7] */
Expand Down

0 comments on commit 0c23ec7

Please sign in to comment.