mirror of
https://github.com/outline/outline.git
synced 2026-01-04 10:09:52 -06:00
fix: Improve matching on quoted queries
This commit is contained in:
@@ -877,7 +877,7 @@ describe("SearchHelper", () => {
|
||||
"this&is&a&test:*"
|
||||
);
|
||||
});
|
||||
test("should now wildcard quoted queries", () => {
|
||||
test("should not wildcard quoted queries", () => {
|
||||
expect(SearchHelper.webSearchQuery(`"this is a test"`)).toBe(
|
||||
`"this<->is<->a<->test"`
|
||||
);
|
||||
|
||||
@@ -470,7 +470,7 @@ export default class SearchHelper {
|
||||
const likelyUrls = getUrls(options.query);
|
||||
|
||||
// remove likely urls, and escape the rest of the query.
|
||||
const limitedQuery = this.escapeQuery(
|
||||
let limitedQuery = this.escapeQuery(
|
||||
likelyUrls
|
||||
.reduce((q, url) => q.replace(url, ""), options.query)
|
||||
.slice(0, this.maxQueryLength)
|
||||
@@ -482,6 +482,9 @@ export default class SearchHelper {
|
||||
(match) => match[1]
|
||||
);
|
||||
|
||||
// remove quoted queries from the limited query
|
||||
limitedQuery = limitedQuery.replace(/"([^"]*)"/g, "");
|
||||
|
||||
const iLikeQueries = [...quotedQueries, ...likelyUrls].slice(0, 3);
|
||||
|
||||
for (const match of iLikeQueries) {
|
||||
|
||||
Reference in New Issue
Block a user