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=${q}`, `indent=true`, `rows=${limit}`, `start=${offset}`, ]; try { // let result = await axios( // process.env.SOLR_HOST + `/solr/searchkey/select?` + params.join('&') // ); let result = await axios.post( process.env.SOLR_HOST + `/solr/searchkey/select`, params.join('&'), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } } ); console.log(result.data); res.status(200).json(result.data); } catch (error) { res.status(500).json({ error: 'Internal Server Error' }); } }