| | |
| | | return [...results[0].result] |
| | | } |
| | | } |
| | | const allIds = [...getByField('title'), ...getByField('content')] |
| | | const finalResults = allIds.map(fetch) |
| | | const allIds = new Set([...getByField('title'), ...getByField('content')]) |
| | | const finalResults = [...allIds].map(fetch) |
| | | |
| | | // display |
| | | if (finalResults.length === 0) { |
| | | results.innerHTML = `<div class="result-card"> |
| | | <p>No results.</p> |
| | | </div>` |
| | | results.innerHTML = `<button class="result-card"> |
| | | <h3>No results.</h3> |
| | | <p>Try another search term?</p> |
| | | </button>` |
| | | } else { |
| | | results.innerHTML = finalResults |
| | | .map(result => resultToHTML({ |
| | |
| | | }) |
| | | }) |
| | | |
| | | </script> |
| | | </script> |