diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-10-25 10:04:34 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-10-25 10:04:34 +0700 |
| commit | bb2fc00e1f399be919d7b777dd0ae17edd6b2a2e (patch) | |
| tree | 793369fa9a42e259f1d7b0c8612632090cfbe536 /src/pages/api | |
| parent | 2657955cb4dc4cbe703d77bb43a6394a8ee98f74 (diff) | |
sitemap categories brand
Diffstat (limited to 'src/pages/api')
| -rw-r--r-- | src/pages/api/shop/url-category_brand.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pages/api/shop/url-category_brand.js b/src/pages/api/shop/url-category_brand.js index cfcc7d73..160aa166 100644 --- a/src/pages/api/shop/url-category_brand.js +++ b/src/pages/api/shop/url-category_brand.js @@ -1,9 +1,12 @@ import axios from 'axios'; export default async function handler(req, res) { - const { url = '' } = req.query; + const { url = '', page = 1, limit = 30 } = req.query; + + let offset = (page - 1) * limit; - const params = [`q.op=AND`, `q=url_s:"${url}"`, `indent=true`]; + const params = [`q.op=AND`, `q=${url ? `"${url}"` : '*'}`, `indent=true`, `rows=${limit}`, `start=${offset}`]; + try { let result = await axios( process.env.SOLR_HOST + |
