Nxsearch
nxsearch: a full-text search engine
Install / Use
/learn @rmind/NxsearchREADME
nxsearch
nxsearch is a full-text search engine library which is also provided with a web server integration.
The engine is written in C11 and is distributed under the 2-clause BSD license.
Upstream at: https://github.com/rmind/nxsearch
Features
- Lightweight, simple and fast.
- BM25 and TF-IDF algorithms.
- Integrates with the Snowball stemmer.
- Supports fuzzy matching (using the BK-tree with Levenshtein distance).
- Supports query logic operators, grouping, nesting, etc.
- Supports filters in Lua for easy extendibility.
- Basic UTF-8 and internationalization support.
Usage
To try as a web service:
# git submodule update --init --recursive # ensure you have submodules
docker-compose up app # spin up the service
open http://127.0.0.1:8000/docs # documentation page
The NXS_BASEDIR environment variable specifies the base directory where
the indexed documents as well as the application data files are stored.
Shell
# Create the index:
curl -XPOST http://127.0.0.1:8000/test-idx
# Index some test documents:
curl -d "cat dog cow" http://127.0.0.1:8000/test-idx/add/1
curl -d "dog cow" http://127.0.0.1:8000/test-idx/add/2
curl -d "cat cat cat" http://127.0.0.1:8000/test-idx/add/3
# Run a query:
curl -s -d "cat" http://127.0.0.1:8000/test-idx/search | jq
Python
You can also use the nxsearch as a Python library.
import nxsearch
from nxsearch import NxsResourceExistsError
nxs = nxsearch.init("./nxs-data")
index = nxs.open("animal-articles", create=True)
index.add(1, "cat dog cow")
index.add(2, "dog cow")
index.add(3, "cat cat cat")
index.add(4, "cat's catnip")
with index.search("cat") as result:
for item in result:
print(item)
Documentation
Related Skills
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
