Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
c9c0a42f
Commit
c9c0a42f
authored
Sep 06, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/searchCard' into 'main'
feat: support keywords for search See merge request
!298
parents
d49f1d95
7af3e605
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
src/middleware/sqlite/fts.ts
src/middleware/sqlite/fts.ts
+5
-4
src/ui/BuildDeck/index.tsx
src/ui/BuildDeck/index.tsx
+1
-1
No files found.
src/middleware/sqlite/fts.ts
View file @
c9c0a42f
...
@@ -25,17 +25,18 @@ export function invokeFts(db: Database, params: FtsParams): CardMeta[] {
...
@@ -25,17 +25,18 @@ export function invokeFts(db: Database, params: FtsParams): CardMeta[] {
const
{
query
,
conditions
}
=
params
;
const
{
query
,
conditions
}
=
params
;
const
ftsMetas
:
CardMeta
[]
=
[];
const
ftsMetas
:
CardMeta
[]
=
[];
const
queryList
=
query
.
trim
().
split
(
"
"
);
const
filterConditions
=
getFtsCondtions
(
conditions
);
const
filterConditions
=
getFtsCondtions
(
conditions
);
const
stmt
=
db
.
prepare
(
`
const
stmt
=
db
.
prepare
(
`
SELECT datas.*, texts.*
SELECT datas.*, texts.*
FROM datas
FROM datas
INNER JOIN texts ON datas.id = texts.id
INNER JOIN texts ON datas.id = texts.id
WHERE texts.name LIKE $query
${
WHERE (texts.name || texts.desc) LIKE $query
filterConditions
?
`AND
${
filterConditions
}
`
:
""
${
filterConditions
?
`AND
${
filterConditions
}
`
:
""
}
}
`
);
`
);
stmt
.
bind
({
$query
:
`%
${
query
}
%`
});
stmt
.
bind
({
$query
:
`%
${
query
List
.
join
(
"
%
"
)
}
%`
});
while
(
stmt
.
step
())
{
while
(
stmt
.
step
())
{
const
row
=
stmt
.
getAsObject
()
as
CardData
&
CardText
;
const
row
=
stmt
.
getAsObject
()
as
CardData
&
CardText
;
...
...
src/ui/BuildDeck/index.tsx
View file @
c9c0a42f
...
@@ -379,7 +379,7 @@ const Search: React.FC = () => {
...
@@ -379,7 +379,7 @@ const Search: React.FC = () => {
<
div
className=
{
styles
.
container
}
ref=
{
dropRef
}
>
<
div
className=
{
styles
.
container
}
ref=
{
dropRef
}
>
<
div
className=
{
styles
.
title
}
>
<
div
className=
{
styles
.
title
}
>
<
Input
<
Input
placeholder=
"
搜索卡片
"
placeholder=
"
关键词(空格分隔)
"
bordered=
{
false
}
bordered=
{
false
}
suffix=
{
suffix=
{
<
Button
<
Button
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment