mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-14 12:46:05 +08:00
feat: support explicit q passing in search
This commit is contained in:
parent
607407f740
commit
e324c4667f
@ -86,11 +86,12 @@ export class SearcherHost extends RPCHost {
|
||||
count: number,
|
||||
crawlerOptions: CrawlerOptions,
|
||||
braveSearchExplicitOperators: BraveSearchExplicitOperatorsDto,
|
||||
@Param('q') q?: string,
|
||||
) {
|
||||
const uid = await auth.solveUID();
|
||||
let chargeAmount = 0;
|
||||
const noSlashPath = ctx.req.url.slice(1);
|
||||
if (!noSlashPath) {
|
||||
if (!noSlashPath && !q) {
|
||||
const latestUser = uid ? await auth.assertUser() : undefined;
|
||||
if (!ctx.req.accepts('text/plain') && (ctx.req.accepts('text/json') || ctx.req.accepts('application/json'))) {
|
||||
|
||||
@ -151,7 +152,7 @@ export class SearcherHost extends RPCHost {
|
||||
delete crawlerOptions.html;
|
||||
|
||||
const crawlOpts = this.crawler.configure(crawlerOptions);
|
||||
const searchQuery = braveSearchExplicitOperators.addTo(ctx.req.path.slice(1));
|
||||
const searchQuery = braveSearchExplicitOperators.addTo(q || ctx.req.path.slice(1));
|
||||
const r = await this.cachedWebSearch({
|
||||
q: searchQuery,
|
||||
count: Math.floor(count + 2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user