fractal-search
Multi-scale document search with φ-weighted decay. Search meaning, not just text.
What it does
Documents are indexed at three scales — document, section, paragraph — like a fractal. Search results are weighted by the golden ratio (φ = 1.618) so direct matches score highest and related matches decay naturally.
Document level → weight: 1.0
Section level → weight: 1/φ ≈ 0.618
Paragraph level → weight: 1/φ² ≈ 0.382
Related terms → weight: 1/φ³ ≈ 0.236
Install
pip install fractal-search
CLI Usage
# Search file contents
fsearch "your query" ~/Documents/
# Search filenames only
fsearch "bazinga deploy" ~/Projects/ --names
# Clean output (just paths, pipeable)
fsearch "darmiyan" ~/Research/ --paths-only
# JSON output
fsearch "trust dimension" . --json
# Verbose with pattern explanations
fsearch "SSRI calcium" ~/papers/ -v --max 20
Python API
from fractal_search import FractalSearchEngine
engine = FractalSearchEngine()
# Add individual documents
engine.add("doc1", "My Paper", "Content about fractals...")
engine.add("doc2", "My Notes", "Something about cooking...")
# Or index a directory
engine.add_directory("~/Documents/", extensions=('.md', '.txt', '.py'))
# Search
results = engine.search("fractal patterns")
for r in results:
print(f"{r.score:.1f} {r.title} {r.doc_id}")
print(f" terms: {r.matching_terms}")
print(f" snippet: {r.snippet[:100]}")
How it works
- Multi-scale fingerprinting — Each document is tokenized at three levels (whole → sections → paragraphs), creating a self-similar index structure
- φ-weighted decay — Results at deeper index levels are weighted by 1/φ per level, using the golden ratio as the optimal relevance decay
- Co-occurrence sub-indexing — Frequently co-occurring terms create sub-indices (fractal branching), so searching "SSRI" also surfaces "sertraline" and "emotional blunting"
- Adaptive depth — Search depth auto-adjusts based on query complexity using Fibonacci sequence modulation
Why φ?
The golden ratio is the fixed point of self-reference: φ - 1 = 1/φ. It's the optimal boundary between local relevance (this paragraph) and global relevance (the whole document). This isn't arbitrary — it's the same ratio that appears in natural information structures from DNA to galaxies.
Author
Abhishek Srivastava — github.com/0x-auth
License
MIT
Metadata
Release files for fractal-search 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fractal_search-0.1.1.tar.gz | 10.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fractal_search-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / fractal_search-0.1.1.tar.gz
| Download URL | fractal_search-0.1.1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6af0c68cd53f00ddccc7da64990bdeb5bcf3dca57f2213f54fa01869b9548a0
|
|
BLAKE2b-256 checksum How to use checksums |
9c767904e8b0e151911b0fd175531b1e31b2626b89a26afe9790f28e2157061e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / fractal_search-0.1.1-py3-none-any.whl
| Download URL | fractal_search-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edf9ae2992c5857c5b685867523a265e58206d35126ba3a497a44186ad41b18a
|
|
BLAKE2b-256 checksum How to use checksums |
b2a10914b198b12f0441d462d1f7a67ab19c6f12e0b1f20b2ed0ba23bdeeb7cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Security for fractal-search 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.