-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved search capabilities #1021
Conversation
Added extended search capabilities
I would propose to go with the gmail like advanced search query syntax and use something like search-query-parser. const searchQueryParser = require("search-query-parser")
function parseSearchQuery(query) {
const options = {
tokenize: true,
alwaysArray: true,
offsets: false,
keywords: ["name", "infra", "seed", "from", "purpose", "version", "ticket"],
ranges: ["date"],
}
return searchQueryParser.parse(query, options)
}
const query =
'from:foo@sap.com,bar@sap.com name:delete purpose:eval date:20200503-20210501 "free text" foo -hugo';
console.log(parseSearchQuery(query))
/*
{
text: [ 'free text', 'foo' ],
from: [ 'foo@sap.com', 'bar@sap.com' ],
name: [ 'delete' ],
purpose: [ 'eval' ],
date: { from: '20200503', to: '20210501' },
exclude: { text: 'hugo' }
}
*/ |
@holgerkoser I thought about that, too. I started with this as an attempt to keep it simple. Idk how parsers perform; we already face huge performance issues in larger lists. We can test it, though. |
@holgerkoser You have pull request review open invite, please check |
const searchPattern = /(-?"[^"]+")*([\S]+)*/g | ||
const termPattern = /^(-)?("?)([^"]+)("?)$/g |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add tests for the regex so that we can be sure in the future that it still works as expected in case we need to adapt it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\lgtm
Added extended search capabilities
What this PR does / why we need it:
Adds more search capabilities (see below). This should solve several raised requirements (see linked issues).
Moreover, this PR introduces a search delay to prevent multiple searches to block the UI while typing.
Which issue(s) this PR fixes:
Fixes #1004 Fixes #994 Fixes #960
Special notes for your reviewer:
Release note: