v1.2.7 - prefix search, keyboard shortcut fixes, GNOME AppImage fix

This commit is contained in:
Yuri Karamian
2026-03-19 19:19:26 +01:00
parent 4897703111
commit bc372993c4
10 changed files with 84 additions and 37 deletions
+1 -1
View File
@@ -1850,7 +1850,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "helixnotes"
version = "1.2.5"
version = "1.2.7"
dependencies = [
"arboard",
"chrono",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "helixnotes"
version = "1.2.5"
version = "1.2.7"
description = "Local markdown note-taking app"
authors = ["HelixNotes"]
license = "AGPL-3.0-or-later"
+22 -3
View File
@@ -257,6 +257,14 @@ pub fn save_note(
drop(config);
operations::save_note(&path, &meta, &body)?;
// Re-index note so search picks up changes immediately
if let Ok(search_guard) = state.search_index.lock() {
if let Some(ref search) = *search_guard {
let _ = search.index_note(&path);
}
}
Ok(())
}
@@ -1368,9 +1376,20 @@ fn resolve_wiki_ref(
pub fn open_file(path: String) -> Result<(), String> {
#[cfg(target_os = "linux")]
{
std::process::Command::new("xdg-open")
.arg(&path)
.spawn()
let mut cmd = std::process::Command::new("xdg-open");
cmd.arg(&path);
// Clear AppImage environment so child processes find host binaries
// (e.g. gio-launch-desktop on GNOME)
if std::env::var("APPIMAGE").is_ok() {
cmd.env_remove("LD_LIBRARY_PATH")
.env_remove("LD_PRELOAD")
.env_remove("GIO_LAUNCHED_DESKTOP_FILE")
.env_remove("GIO_LAUNCHED_DESKTOP_FILE_PID");
if let Ok(original_path) = std::env::var("PATH_ORIG") {
cmd.env("PATH", original_path);
}
}
cmd.spawn()
.map_err(|e| format!("Failed to open {}: {}", path, e))?;
}
#[cfg(target_os = "macos")]
+32 -9
View File
@@ -9,9 +9,9 @@ use tantivy::collector::TopDocs;
use tantivy::directory::MmapDirectory;
#[cfg(target_os = "android")]
use tantivy::directory::RamDirectory;
use tantivy::query::QueryParser;
use tantivy::query::{BooleanQuery, FuzzyTermQuery, Occur, PhrasePrefixQuery, Query};
use tantivy::schema::*;
use tantivy::{Index, IndexWriter, TantivyDocument};
use tantivy::{Index, IndexWriter, TantivyDocument, Term};
use walkdir::WalkDir;
pub struct SearchIndex {
@@ -152,14 +152,37 @@ impl SearchIndex {
let reader = self.index.reader().map_err(|e| e.to_string())?;
let searcher = reader.searcher();
let query_parser = QueryParser::for_index(
&self.index,
vec![self.title_field, self.body_field, self.tags_field],
);
let fields = vec![self.title_field, self.body_field, self.tags_field];
let terms: Vec<String> = query_str
.split_whitespace()
.map(|t| t.to_lowercase())
.collect();
let query = query_parser
.parse_query(query_str)
.map_err(|e| e.to_string())?;
// For each search term, create prefix + fuzzy queries across all fields (OR),
// then AND all terms together
let term_queries: Vec<(Occur, Box<dyn Query>)> = terms
.iter()
.map(|term| {
let field_queries: Vec<(Occur, Box<dyn Query>)> = fields
.iter()
.flat_map(|&field| {
let prefix: Box<dyn Query> = Box::new(PhrasePrefixQuery::new(
vec![Term::from_field_text(field, term)],
));
let fuzzy: Box<dyn Query> = Box::new(FuzzyTermQuery::new(
Term::from_field_text(field, term),
1,
true,
));
vec![(Occur::Should, prefix), (Occur::Should, fuzzy)]
})
.collect();
let combined: Box<dyn Query> = Box::new(BooleanQuery::new(field_queries));
(Occur::Must, combined)
})
.collect();
let query = BooleanQuery::new(term_queries);
let top_docs = searcher
.search(&query, &TopDocs::with_limit(limit))
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "HelixNotes",
"version": "1.2.6",
"version": "1.2.7",
"identifier": "com.helixnotes.app",
"build": {
"frontendDist": "../build",