@hydrooj/elastic-search
Advanced tools
Comparing version 1.1.3 to 1.1.4
12
index.ts
@@ -30,3 +30,3 @@ import { Client } from '@elastic/elasticsearch'; | ||
simple_query_string: { | ||
query: q, | ||
query: q.replace(/([a-z0-9]{2,})/gi, (i) => `${i}~5`), | ||
fields: ['tag^5', 'pid^4', 'title^3', 'content'], | ||
@@ -42,6 +42,14 @@ }, | ||
}); | ||
let hits = res.hits.hits.map((i) => i._id); | ||
if (!opts.skip) { | ||
const pdoc = await ProblemModel.get(domainId, +q || q, ProblemModel.PROJECTION_LIST); | ||
if (pdoc) { | ||
hits = hits.filter((i) => i !== `${pdoc.domainId}/${pdoc.docId}`); | ||
hits.unshift(`${pdoc.domainId}/${pdoc.docId}`); | ||
} | ||
} | ||
return { | ||
countRelation: typeof res.hits.total === 'number' ? 'eq' : res.hits.total.relation, | ||
total: typeof res.hits.total === 'number' ? res.hits.total : res.hits.total.value, | ||
hits: res.hits.hits.map((i) => i._id), | ||
hits, | ||
}; | ||
@@ -48,0 +56,0 @@ }; |
{ | ||
"name": "@hydrooj/elastic-search", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"main": "index.ts", | ||
@@ -9,4 +9,4 @@ "repository": "https://github.com/hydro-dev/Hydro", | ||
"dependencies": { | ||
"@elastic/elasticsearch": "^8.12.2" | ||
"@elastic/elasticsearch": "^8.13.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4714
102