Commit c9c0a42f authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feature/searchCard' into 'main'

feat: support keywords for search

See merge request mycard/Neos!298
parents d49f1d95 7af3e605
Pipeline #23385 passed with stages
in 15 minutes and 41 seconds
......@@ -25,17 +25,18 @@ export function invokeFts(db: Database, params: FtsParams): CardMeta[] {
const { query, conditions } = params;
const ftsMetas: CardMeta[] = [];
const queryList = query.trim().split(" ");
const filterConditions = getFtsCondtions(conditions);
const stmt = db.prepare(`
SELECT datas.*, texts.*
FROM datas
INNER JOIN texts ON datas.id = texts.id
WHERE texts.name LIKE $query ${
filterConditions ? `AND ${filterConditions}` : ""
}
WHERE (texts.name || texts.desc) LIKE $query
${filterConditions ? `AND ${filterConditions}` : ""}
`);
stmt.bind({ $query: `%${query}%` });
stmt.bind({ $query: `%${queryList.join("%")}%` });
while (stmt.step()) {
const row = stmt.getAsObject() as CardData & CardText;
......
......@@ -379,7 +379,7 @@ const Search: React.FC = () => {
<div className={styles.container} ref={dropRef}>
<div className={styles.title}>
<Input
placeholder="搜索卡片"
placeholder="关键词(空格分隔)"
bordered={false}
suffix={
<Button
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment