Skip to content

Commit

Permalink
improve search algorithm ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
lasantosr committed May 15, 2023
1 parent d69e33c commit fc75983
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl SqliteStorage {
SELECT c.rowid, c.category, c.alias, c.cmd, c.description, c.usage, 2 as ord
FROM command_fts s
JOIN command c ON s.rowid = c.rowid
WHERE command_fts MATCH :match_ordered
WHERE command_fts MATCH :match_cmd_ordered
UNION ALL
Expand All @@ -329,8 +329,8 @@ impl SqliteStorage {
"#,
)?;

let match_ordered = format!(
"^{}",
let match_cmd_ordered = format!(
"\"flat_cmd\" : ^{}",
flat_search
.split_whitespace()
.map(|token| format!("{token}*"))
Expand All @@ -347,7 +347,7 @@ impl SqliteStorage {

let commands = stmt
.query(&[
(":match_ordered", &match_ordered),
(":match_cmd_ordered", &match_cmd_ordered),
(":match_simple", &match_simple),
(":glob", &glob),
])?
Expand Down

0 comments on commit fc75983

Please sign in to comment.