()
| 149 | } |
| 150 | |
| 151 | public async search() { |
| 152 | this.state = await this.getCache(); |
| 153 | |
| 154 | if (!this.state) { |
| 155 | this.state = await this.searchLocal(); |
| 156 | } |
| 157 | |
| 158 | if (!this.state) { |
| 159 | this.state = await this.searchForIt(); |
| 160 | } |
| 161 | |
| 162 | if ( |
| 163 | !this.state || |
| 164 | (this.state && !['user', 'firebase', 'sync', 'local'].includes(this.state.provider)) |
| 165 | ) { |
| 166 | const tempRes = await this.onsiteSearch(); |
| 167 | if (tempRes) this.state = tempRes; |
| 168 | } |
| 169 | |
| 170 | if (this.state) { |
| 171 | await this.setCache(this.state); |
| 172 | } |
| 173 | |
| 174 | this.logger.log('Result', this.state); |
| 175 | |
| 176 | return this.state; |
| 177 | } |
| 178 | |
| 179 | protected async getCache() { |
| 180 | return api.storage.get(`${this.page.name}/${this.identifier}/Search`).then(state => { |
no test coverage detected