Skip to content

Commit

Permalink
Skohub: Check if search index is empty (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Jun 22, 2022
1 parent 3cb202b commit d4e34cf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/providers/skohub-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ export default class SkohubProvider extends BaseProvider {
postfix = `index${postfix}`
}
const data = await this.axios({ url: `${scheme.uri}${postfix}`, _skipAdditionalParameters: true })
if (data.length < 100) {
// Assume the index is empty and skip it
this._index[scheme.uri][lang] = null
continue
}
index = FlexSearch.create()
index.import(data)
this._index[scheme.uri][lang] = index
Expand Down

0 comments on commit d4e34cf

Please sign in to comment.