diff options
Diffstat (limited to 'src/pages/api/shop/searchkey.js')
| -rw-r--r-- | src/pages/api/shop/searchkey.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pages/api/shop/searchkey.js b/src/pages/api/shop/searchkey.js index e8b535e7..2735e72c 100644 --- a/src/pages/api/shop/searchkey.js +++ b/src/pages/api/shop/searchkey.js @@ -3,11 +3,18 @@ import axios from 'axios'; export default async function handler(req, res) { const { url = '', page = 1, limit = 30 } = req.query; + let q = '*:*'; + + if (!req.query.all) { + const url = (req.query.q || '').trim(); + q = `keywords_s:"${url}"`; + } let offset = (page - 1) * limit; const params = [ `q.op=AND`, - `q=keywords_s:"${url}"`, + // `q=keywords_s:"${url}"`, + `q=${q}`, `indent=true`, `rows=${limit}`, `start=${offset}`, |
