ftsutil

package
v1.0.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ftsutil provides shared utilities for building and querying SQLite FTS5 full-text search databases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFTSQuery

func BuildFTSQuery(userQuery string) string

BuildFTSQuery converts a user's free-text search string into an FTS5 query. Words are joined with OR for broad matching; BM25 ranking naturally boosts documents matching more terms.

Examples:

"subscribedSkus licenses"  -> "subscribedSkus OR licenses"
"send mail"                -> "send OR mail"
""                         -> ""

func JoinStrings

func JoinStrings(ss []string, sep string) string

JoinStrings joins a slice of strings with a separator, useful for converting []string fields to a single searchable text column.

func OpenDB

func OpenDB(path string) (*sql.DB, error)

OpenDB opens (or creates) a SQLite database with pragmas tuned for read-heavy workloads. Callers must close the returned *sql.DB.

func OpenReadOnly

func OpenReadOnly(path string) (*sql.DB, error)

OpenReadOnly opens a SQLite database in read-only mode with pragmas tuned for fast querying.

func SplitCamelCase

func SplitCamelCase(s string) string

SplitCamelCase splits camelCase and PascalCase identifiers into separate words for better FTS matching. e.g. "subscribedSkus" -> "subscribed Skus subscribedSkus"

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL