[package]
name = "quicksearch-core"
version.workspace = true
edition.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
description = "Indexing, storage and search engine behind QuickSearch."

[lib]
name = "quicksearch_core"
path = "src/lib.rs"

[dependencies]
# `bundled-sqlcipher-vendored-openssl` compiles the SQLCipher amalgamation
# (a superset of the stock SQLite `bundled` build — FTS5 etc. included) and
# statically links a vendored OpenSSL libcrypto, so encryption support adds
# no runtime library dependencies. With no `PRAGMA key` applied, SQLCipher
# behaves identically to stock SQLite, so unencrypted indexes are unaffected.
rusqlite = { version = "0.39", features = ["bundled-sqlcipher-vendored-openssl"] }
argon2 = { version = "0.5", features = ["zeroize"] }
zeroize = { version = "1", features = ["derive"] }
getrandom = "0.2"
sha2 = "0.10.8"
walkdir = "2.5.0"
# Default features pull in zstd 0.11, which cannot unify with our zstd 0.13 below
# and so builds a second copy of the wrapper crates. We only read OOXML/ODF
# containers (docx/xlsx/pptx/odt/ods/odp), whose entries are always deflate or
# stored, so zstd/bzip2/aes-crypto are all dead weight here.
zip = { version = "0.6", default-features = false, features = ["deflate"] }
quick-xml = "0.31"
# OLE2 compound-file reader, for the pre-2007 binary Office formats
# (.doc/.xls/.ppt) whose text lives in named streams rather than a zip. Already
# in the lockfile transitively via infer, so naming it directly compiles
# nothing new.
cfb = "0.7"
serde = { version = "1.0", features = ["derive"] }
# 1.x, not 0.8: 0.8 pulls `toml_edit`, the whole format-preserving document
# model, for what is only `from_str` and `to_string_pretty` here. 1.x parses and
# writes as a stream instead - no `toml_edit`, no `winnow` 0.5 alongside the 1.0
# already in the tree - which is 252 KB of `.text` this crate was paying for a
# document API it never touches.
toml = "1"
mime_guess = "2.0"
infer = "0.15"
# Charset decoding for non-UTF-8 text (UTF-16 .reg exports, legacy
# single-byte and CJK encodings). Already in the lockfile transitively via
# pdf-extract, so naming it directly compiles nothing new.
encoding_rs = "0.8"
# Statistical charset detection (Firefox's detector) for text that is neither
# UTF-8 nor BOM-marked. Its mandatory deps beyond encoding_rs are tiny
# (cfg-if, memchr, detone).
chardetng = "1.0"
# RTF text extraction. Pure Rust; with the default `jsbindings` feature off
# (it exists for the crate's WASM build) it depends only on serde.
rtf-parser = { version = "0.4", default-features = false }
# `lopdf` is deliberately NOT declared here. `pdf-extract` re-exports it
# (`pub use lopdf::*`), and `extract/pdf.rs` reaches it that way. Naming it
# directly resolves a *second*, older copy alongside pdf-extract's — which is
# what used to make every PDF parse twice, and what pulled in rayon (whose
# global thread pool is never torn down), chrono, time, md5 and a second nom.
pdf-extract = "0.12"
lofty = "0.19"
# Parked with `extract::image` — see `extract::ExtractedContent`.
# kamadak-exif = "0.5"
notify = "6.1"
ctrlc = "3.4"
zstd = "0.13"
globset = "0.4"
regex = "1"
# SIMD substring search for the full-text passes. `str::match_indices` uses
# std's Two-Way searcher, which has no vector prefilter: measured against a
# 256 KiB body (`benches/search.rs`, group `substring`) it runs 111 µs where
# `memmem` runs 2.4 µs, and the full-text passes scan a body per candidate
# row. Already in the lockfile transitively (regex, globset, chardetng), so
# naming it directly compiles nothing new.
memchr = "2"

# `nice()`, for dropping indexing threads to background scheduling priority.
# Linux schedules per task, so it affects only the calling thread. Already in
# the lockfile transitively (rusqlite, getrandom), so naming it directly
# compiles nothing new.
[target.'cfg(unix)'.dependencies]
libc = "0.2"

# `GetDriveTypeW` (a mapped drive letter is the only way to spot an SMB share
# that isn't written as UNC) plus the FILE_ATTRIBUTE_* constants, which
# `platform.rs` spells out for itself so its tests run on Linux and then
# const-asserts against this crate on Windows builds.
# Pinned to 0.52 deliberately: walkdir → winapi-util already
# resolves exactly that version, so this adds no new crate compilations.
[target.'cfg(windows)'.dependencies]
# GetDriveTypeW and the FILE_ATTRIBUTE_* constants live in
# Win32_Storage_FileSystem; DRIVE_REMOTE, oddly, is filed under
# Win32_System_WindowsProgramming. Win32_System_Threading carries
# SetThreadPriority and THREAD_MODE_BACKGROUND_BEGIN, and both it and
# GetCurrentThread need Win32_Foundation for HANDLE/BOOL.
windows-sys = { version = "0.52", features = [
    "Win32_Foundation",
    # SECURITY_ATTRIBUTES, which `CreateFileW`'s signature names even though
    # the directory-count path passes null for it.
    "Win32_Security",
    "Win32_Storage_FileSystem",
    "Win32_System_Threading",
    "Win32_System_WindowsProgramming",
] }

# Microbenchmark harness for `benches/`. Criterion is the more common choice
# and was rejected: it pulls rayon (a global thread pool that never tears
# down, the same reason `lopdf` is not named directly above) plus plotters and
# clap, some forty crates. Divan's mandatory set is a handful and it spawns no
# threads of its own.
[dev-dependencies]
divan = "0.1"

# `harness = false` on both: divan supplies its own `main` via `divan::main()`,
# so libtest must not also link one in.
[[bench]]
name = "search"
harness = false

[[bench]]
name = "index"
harness = false
