Line Search

by sinaaxe
5
4
3
2
1
New Plugin

Description

This plugin has not been manually reviewed by Obsidian staff. Uses each line as a separate unit for fuzzy and out-of-order word search across all Markdown files in the vault.

Reviews

No reviews yet.

Stats

stars
downloads
0
forks
0
days
NaN
days
NaN
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

Invalid date

Changelog

README file from

Github

Obsidian Line Search Plugin

Line Search is a high-performance, community plugin for Obsidian that lets you search and rank individual lines across all Markdown files in your vault. It supports typo-tolerant prefix matching and out-of-order multi-word matching while maintaining a lightweight in-memory index that updates incrementally in real time.


Key Features

  1. Single-Line Centric Search:

    • Searches every line of every Markdown file as an independent search unit.
    • Shows matching lines directly in the suggestions list.
  2. Advanced Matching & Ranking:

    • Out-of-Order Multi-Word Search: Querying space-separated terms (e.g. hello world) matches lines containing all terms in any order (AND search).
    • Exact Substring Match: High-priority matching for exact term matches in the line.
    • Typo-Tolerant Word Prefix Match: For query terms of 3-5 characters, matches words with up to 1 typo; for terms of 6 or more characters, matches words with up to 2 typos.
    • Dynamic Scoring:
      • Higher scores for exact matches and word-boundary starts.
      • Sequence order bonus (+20 score) when terms appear in the same order as the query.
      • Slighly penalizes long lines (by 0.01 per character) to favor short and concise matches.
      • Typo penalty applied for fuzzy matches based on Levenshtein distance.
  3. Premium Suggestion UI:

    • Native integration with Obsidian's Command Palette suggestions layout.
    • Highlight rendering showing precisely which characters in the line matched your query.
    • Shows metadata badge for the file path and the line number.
  4. Editor Navigation:

    • Hitting Enter or clicking on a suggestion opens the note.
    • Automatically scrolls the editor to center the target line and moves the cursor directly to the line.
    • Support for opening files in new tabs/panes by holding the Ctrl/Cmd modifier key.
  5. Optimized Background Indexer:

    • Skips empty lines to reduce memory consumption.
    • Keeps pre-lowercased line references in memory to maximize performance.
    • Updates incrementally in the background using vault event listeners (create, modify, delete, and rename), avoiding full re-indexing steps.

How to Use

  • Open the Command Palette (Ctrl/Cmd + P), type Line Search: Open line search, and press Enter. (Alternatively, click the magnifying glass ribbon icon on the left sidebar).
  • Type your search terms (separated by spaces).
  • Use the arrow keys to navigate matching lines, and hit Enter to open and jump directly to that line.

Settings

  • Minimum query length: The minimum characters you need to type before the search starts.
  • Maximum results: The maximum number of results to display in the list (defaults to 10 to keep rendering fast).
  • Exclude folders: Comma-separated list of directories (e.g., templates, archive) to ignore during line indexing.

Security & Privacy

Vault Enumeration & Data Access

This plugin uses the Obsidian API (app.vault.getMarkdownFiles) to enumerate files in your vault.

  • Why it is needed: This is required to discover Markdown files, read their content, and build a local, in-memory index of all lines so they can be searched instantly.
  • Privacy & Local-First: All indexing, scanning, and search matching run entirely on your local machine. No vault data, file paths, or search queries ever leave your device or get transmitted over the internet.

License

This project is licensed under the MIT License.


Local Development & Installation

Building From Source

If you are compiling this plugin from source:

  1. Clone or download the repository files.
  2. Open a terminal in the plugin directory and run:
    npm install
    
  3. Compile and bundle the plugin:
    npm run build
    
    This will generate a build/ folder containing the compiled code bundle (main.js), metadata (manifest.json), and stylesheets (styles.css).

Loading into Obsidian

  1. Copy the build folder into your Obsidian vault's plugins folder under the name line-search:
    cp -r build <path-to-your-vault>/.obsidian/plugins/line-search
    
  2. Open Obsidian and go to Settings -> Community plugins.
  3. Enable Line Search from the list of installed plugins.