lancer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLancer - LanceDB CLI and MCP Server Skill
Lancer - LanceDB CLI与MCP Server Skill
You are a specialist in using , a CLI and MCP server for LanceDB that provides semantic and full-text search with multi-modal support (text and images). This skill provides comprehensive workflows, best practices, and common patterns for document ingestion, search, and table management.
lancer你是使用的专家,这是一款为LanceDB打造的CLI与MCP服务器工具,支持语义搜索、全文搜索以及多模态(文本与图像)检索。本Skill提供了文档摄入、搜索与表管理的完整工作流、最佳实践及常见模式。
lancerWhat is Lancer?
什么是Lancer?
lancer- Semantic search: Find documents by meaning, not just keywords
- Multi-modal support: Index and search both text and images
- LanceDB integration: Efficient vector database storage and retrieval
- Flexible ingestion: Support for multiple file formats (txt, md, pdf, sql, images)
- MCP server mode: Integration with Claude Desktop and other MCP clients
lancer- 语义搜索:基于内容含义查找文档,而非仅依赖关键词
- 多模态支持:索引并搜索文本与图像内容
- LanceDB集成:高效的向量数据库存储与检索
- 灵活的摄入方式:支持多种文件格式(txt、md、pdf、sql、图像)
- MCP服务器模式:与Claude Desktop及其他MCP客户端集成
Core Capabilities
核心功能
- Ingest: Add documents to LanceDB with automatic chunking and embedding
- Search: Semantic similarity search across documents
- Tables: Manage LanceDB tables (list, info, delete)
- Remove: Remove documents from tables
- MCP: Run as Model Context Protocol server
- 摄入:自动完成分块与嵌入,将文档添加至LanceDB
- 搜索:跨文档执行语义相似度搜索
- 表管理:管理LanceDB表(列出、查看信息、删除)
- 移除:从表中删除文档
- MCP服务:以模型上下文协议(Model Context Protocol)服务器模式运行
Quick Start
快速开始
Basic Search
基础搜索
bash
undefinedbash
undefinedSearch all tables
搜索所有表
lancer search "how to deploy kubernetes"
lancer search "how to deploy kubernetes"
Search specific table with more results
搜索指定表并获取更多结果
lancer search -t docs -l 20 "authentication methods"
lancer search -t docs -l 20 "authentication methods"
Search with similarity threshold
设置相似度阈值进行搜索
lancer search --threshold 0.7 "error handling patterns"
undefinedlancer search --threshold 0.7 "error handling patterns"
undefinedBasic Ingestion
基础摄入
bash
undefinedbash
undefinedIngest a single file
摄入单个文件
lancer ingest document.md
lancer ingest document.md
Ingest a directory
摄入整个目录
lancer ingest ./docs/
lancer ingest ./docs/
Ingest multiple paths
摄入多个路径
lancer ingest file1.md file2.pdf ./images/
undefinedlancer ingest file1.md file2.pdf ./images/
undefinedDocument Ingestion
文档摄入
Ingest Command Options
摄入命令选项
bash
undefinedbash
undefinedIngest to specific table
摄入至指定表
lancer ingest -t my_docs document.md
lancer ingest -t my_docs document.md
Ingest with file extension filter
按文件扩展名过滤后摄入
lancer ingest -e md,txt,pdf ./docs/
lancer ingest -e md,txt,pdf ./docs/
Ingest from stdin (pipe file paths)
从标准输入摄入(通过管道传递文件路径)
find ./docs -name "*.md" | lancer ingest --stdin
find ./docs -name "*.md" | lancer ingest --stdin
Ingest from file list
从文件列表中摄入
lancer ingest --files-from paths.txt
lancer ingest --files-from paths.txt
Custom chunk size and overlap
自定义分块大小与重叠度
lancer ingest --chunk-size 2000 --chunk-overlap 400 document.md
undefinedlancer ingest --chunk-size 2000 --chunk-overlap 400 document.md
undefinedSupported File Types
支持的文件类型
Text formats:
- - Plain text files
txt - - Markdown documents
md - - PDF documents
pdf - - SQL scripts
sql
Image formats:
- ,
jpg- JPEG imagesjpeg - - PNG images
png - - GIF images
gif - - Bitmap images
bmp - - WebP images
webp - ,
tiff- TIFF imagestif - - SVG vector graphics
svg - - Icon files
ico
文本格式:
- - 纯文本文件
txt - - Markdown文档
md - - PDF文档
pdf - - SQL脚本
sql
图像格式:
- ,
jpg- JPEG图像jpeg - - PNG图像
png - - GIF图像
gif - - 位图图像
bmp - - WebP图像
webp - ,
tiff- TIFF图像tif - - SVG矢量图形
svg - - 图标文件
ico
Embedding Models
嵌入模型
Text models:
bash
undefined文本模型:
bash
undefinedDefault: all-MiniLM-L6-v2 (fast, good quality)
默认模型:all-MiniLM-L6-v2(速度快,质量佳)
lancer ingest document.md
lancer ingest document.md
Larger model for better quality
更大模型以提升质量
lancer ingest --text-model all-MiniLM-L12-v2 document.md
lancer ingest --text-model all-MiniLM-L12-v2 document.md
BGE models (better semantic understanding)
BGE模型(语义理解能力更强)
lancer ingest --text-model bge-small-en-v1.5 document.md
lancer ingest --text-model bge-base-en-v1.5 document.md
**Image models:**
```bashlancer ingest --text-model bge-small-en-v1.5 document.md
lancer ingest --text-model bge-base-en-v1.5 document.md
**图像模型:**
```bashDefault: clip-vit-b-32 (cross-modal text/image)
默认模型:clip-vit-b-32(跨模态文本/图像检索)
lancer ingest image.jpg
lancer ingest image.jpg
ResNet50 for image-only search
ResNet50仅用于图像搜索
lancer ingest --image-model resnet50 image.jpg
**Advanced: Force specific model:**
```bashlancer ingest --image-model resnet50 image.jpg
**进阶:强制使用指定模型**
```bashForce CLIP for text (enables future image additions)
强制使用CLIP处理文本(支持后续添加图像)
lancer ingest --embedding-model clip-vit-b-32 document.md
lancer ingest --embedding-model clip-vit-b-32 document.md
Force BGE for performance (text-only)
强制使用BGE以提升性能(仅文本)
lancer ingest --embedding-model BAAI/bge-small-en-v1.5 document.md
undefinedlancer ingest --embedding-model BAAI/bge-small-en-v1.5 document.md
undefinedIngestion Optimization
摄入优化
bash
undefinedbash
undefinedFilter by file size
按文件大小过滤
lancer ingest --min-file-size 1000 --max-file-size 10000000 ./docs/
lancer ingest --min-file-size 1000 --max-file-size 10000000 ./docs/
Skip embedding generation (metadata only)
跳过嵌入生成(仅存储元数据)
lancer ingest --no-embeddings document.md
lancer ingest --no-embeddings document.md
Custom batch size for database writes
自定义数据库写入的批量大小
lancer ingest --batch-size 200 ./large-dataset/
lancer ingest --batch-size 200 ./large-dataset/
JSON output for scripting
以JSON格式输出(用于脚本)
lancer ingest --format json document.md
undefinedlancer ingest --format json document.md
undefinedSearch Operations
搜索操作
Search Command Options
搜索命令选项
bash
undefinedbash
undefinedBasic search
基础搜索
lancer search "kubernetes deployment"
lancer search "kubernetes deployment"
Search specific table
搜索指定表
lancer search -t docs "authentication"
lancer search -t docs "authentication"
Limit results
限制结果数量
lancer search -l 5 "error handling"
lancer search -l 5 "error handling"
Set similarity threshold (0.0-1.0)
设置相似度阈值(0.0-1.0)
lancer search --threshold 0.6 "database migration"
lancer search --threshold 0.6 "database migration"
Include embeddings in results
在结果中包含嵌入向量
lancer search --include-embeddings "API design"
lancer search --include-embeddings "API design"
JSON output
以JSON格式输出
lancer search --format json "machine learning"
undefinedlancer search --format json "machine learning"
undefinedMetadata Filters
元数据过滤
bash
undefinedbash
undefinedSingle filter (field:operator:value)
单个过滤条件(字段:操作符:值)
lancer search --filter "author:eq:John" "AI research"
lancer search --filter "author:eq:John" "AI research"
Multiple filters
多个过滤条件
lancer search
--filter "author:eq:John"
--filter "year:gt:2020"
"deep learning"
--filter "author:eq:John"
--filter "year:gt:2020"
"deep learning"
lancer search
--filter "author:eq:John"
--filter "year:gt:2020"
"deep learning"
--filter "author:eq:John"
--filter "year:gt:2020"
"deep learning"
Available operators:
支持的操作符:
eq (equals), ne (not equals)
eq(等于)、ne(不等于)
gt (greater than), lt (less than)
gt(大于)、lt(小于)
gte (greater/equal), lte (less/equal)
gte(大于等于)、lte(小于等于)
in (in list), contains (string contains)
in(在列表中)、contains(字符串包含)
undefinedundefinedSearch Examples
搜索示例
bash
undefinedbash
undefinedFind recent documentation
查找最新文档
lancer search
-t docs
--filter "date:gte:2024-01-01"
-l 10
"API endpoints"
-t docs
--filter "date:gte:2024-01-01"
-l 10
"API endpoints"
lancer search
-t docs
--filter "date:gte:2024-01-01"
-l 10
"API endpoints"
-t docs
--filter "date:gte:2024-01-01"
-l 10
"API endpoints"
Search by category
按分类搜索
lancer search
--filter "category:eq:tutorial"
"getting started"
--filter "category:eq:tutorial"
"getting started"
lancer search
--filter "category:eq:tutorial"
"getting started"
--filter "category:eq:tutorial"
"getting started"
Multi-criteria search
多条件搜索
lancer search
-t technical_docs
--filter "language:eq:python"
--filter "level:eq:advanced"
--threshold 0.7
-l 15
"async programming patterns"
-t technical_docs
--filter "language:eq:python"
--filter "level:eq:advanced"
--threshold 0.7
-l 15
"async programming patterns"
undefinedlancer search
-t technical_docs
--filter "language:eq:python"
--filter "level:eq:advanced"
--threshold 0.7
-l 15
"async programming patterns"
-t technical_docs
--filter "language:eq:python"
--filter "level:eq:advanced"
--threshold 0.7
-l 15
"async programming patterns"
undefinedTable Management
表管理
List Tables
列出表
bash
undefinedbash
undefinedList all tables
列出所有表
lancer tables list
lancer tables list
JSON output
以JSON格式输出
lancer tables list --format json
undefinedlancer tables list --format json
undefinedTable Information
表信息
bash
undefinedbash
undefinedGet table details
获取表详情
lancer tables info my_table
lancer tables info my_table
JSON output for scripting
以JSON格式输出(用于脚本)
lancer tables info my_table --format json
undefinedlancer tables info my_table --format json
undefinedDelete Table
删除表
bash
undefinedbash
undefinedDelete a table (be careful!)
删除表(操作请谨慎!)
lancer tables delete old_table
undefinedlancer tables delete old_table
undefinedRemove Documents
移除文档
bash
undefinedbash
undefinedRemove specific documents from a table
从指定表中移除特定文档
lancer remove -t docs document_id
lancer remove -t docs document_id
Remove multiple documents
移除多个文档
lancer remove -t docs id1 id2 id3
undefinedlancer remove -t docs id1 id2 id3
undefinedConfiguration
配置
Using Config File
使用配置文件
bash
undefinedbash
undefinedSpecify config file
指定配置文件
lancer -c ~/.lancer/config.toml search "query"
lancer -c ~/.lancer/config.toml search "query"
Set default table in config
在配置中设置默认表
lancer -c config.toml ingest document.md
undefinedlancer -c config.toml ingest document.md
undefinedEnvironment Variables
环境变量
bash
undefinedbash
undefinedSet default table
设置默认表
export LANCER_TABLE=my_docs
lancer search "query" # Searches my_docs
export LANCER_TABLE=my_docs
lancer search "query" # 搜索my_docs表
Set log level
设置日志级别
export LANCER_LOG_LEVEL=debug
lancer ingest document.md
undefinedexport LANCER_LOG_LEVEL=debug
lancer ingest document.md
undefinedLog Levels
日志级别
bash
undefinedbash
undefinedError only
仅显示错误
lancer --log-level error search "query"
lancer --log-level error search "query"
Warning
显示警告
lancer --log-level warn ingest document.md
lancer --log-level warn ingest document.md
Info (default)
显示信息(默认)
lancer --log-level info search "query"
lancer --log-level info search "query"
Debug
显示调试信息
lancer --log-level debug ingest document.md
lancer --log-level debug ingest document.md
Trace (verbose)
显示追踪信息(详细)
lancer --log-level trace search "query"
undefinedlancer --log-level trace search "query"
undefinedCommon Workflows
常见工作流
Workflow 1: Index Documentation
工作流1:索引文档
bash
undefinedbash
undefined1. Ingest markdown docs
1. 摄入Markdown文档
lancer ingest -t docs -e md ./documentation/
lancer ingest -t docs -e md ./documentation/
2. Verify ingestion
2. 验证摄入结果
lancer tables info docs
lancer tables info docs
3. Test search
3. 测试搜索
lancer search -t docs "installation guide"
lancer search -t docs "installation guide"
4. Refine search with threshold
4. 通过阈值优化搜索
lancer search -t docs --threshold 0.7 -l 5 "configuration"
undefinedlancer search -t docs --threshold 0.7 -l 5 "configuration"
undefinedWorkflow 2: Multi-modal Image Search
工作流2:多模态图像搜索
bash
undefinedbash
undefined1. Ingest images with CLIP model
1. 使用CLIP模型摄入图像
lancer ingest -t images -e jpg,png,webp
--image-model clip-vit-b-32
./photos/
--image-model clip-vit-b-32
./photos/
lancer ingest -t images -e jpg,png,webp
--image-model clip-vit-b-32
./photos/
--image-model clip-vit-b-32
./photos/
2. Search images with text query
2. 通过文本查询搜索图像
lancer search -t images "sunset over mountains"
lancer search -t images "sunset over mountains"
3. Search with higher threshold for precision
3. 设置更高阈值以提升精度
lancer search -t images --threshold 0.8 "red car"
undefinedlancer search -t images --threshold 0.8 "red car"
undefinedWorkflow 3: Mixed Content Corpus
工作流3:混合内容语料库
bash
undefinedbash
undefined1. Ingest with CLIP for cross-modal search
1. 使用CLIP摄入以支持跨模态搜索
lancer ingest -t knowledge_base
--embedding-model clip-vit-b-32
-e md,pdf,jpg,png
./content/
--embedding-model clip-vit-b-32
-e md,pdf,jpg,png
./content/
lancer ingest -t knowledge_base
--embedding-model clip-vit-b-32
-e md,pdf,jpg,png
./content/
--embedding-model clip-vit-b-32
-e md,pdf,jpg,png
./content/
2. Search text and images together
2. 同时搜索文本与图像
lancer search -t knowledge_base "architecture diagrams"
lancer search -t knowledge_base "architecture diagrams"
3. Filter by file type
3. 按文件类型过滤
lancer search -t knowledge_base
--filter "file_type:eq:png"
"system design"
--filter "file_type:eq:png"
"system design"
undefinedlancer search -t knowledge_base
--filter "file_type:eq:png"
"system design"
--filter "file_type:eq:png"
"system design"
undefinedWorkflow 4: Batch Ingestion
工作流4:批量摄入
bash
undefinedbash
undefined1. Generate file list
1. 生成文件列表
find ./corpus -type f -name "*.md" > files.txt
find ./corpus -type f -name "*.md" > files.txt
2. Ingest from list with custom settings
2. 从列表中摄入并自定义设置
lancer ingest -t corpus
--files-from files.txt
--chunk-size 1500
--chunk-overlap 300
--batch-size 150
--files-from files.txt
--chunk-size 1500
--chunk-overlap 300
--batch-size 150
lancer ingest -t corpus
--files-from files.txt
--chunk-size 1500
--chunk-overlap 300
--batch-size 150
--files-from files.txt
--chunk-size 1500
--chunk-overlap 300
--batch-size 150
3. Verify ingestion
3. 验证摄入结果
lancer tables info corpus
lancer tables info corpus
4. Test search quality
4. 测试搜索质量
lancer search -t corpus -l 10 "sample query"
undefinedlancer search -t corpus -l 10 "sample query"
undefinedWorkflow 5: Update Existing Corpus
工作流5:更新现有语料库
bash
undefinedbash
undefined1. Ingest new documents
1. 摄入新文档
lancer ingest -t docs ./new_docs/
lancer ingest -t docs ./new_docs/
2. Search to verify new content
2. 搜索以验证新内容
lancer search -t docs "recent feature"
lancer search -t docs "recent feature"
3. Remove outdated documents
3. 移除过时文档
lancer remove -t docs old_doc_id
lancer remove -t docs old_doc_id
4. Verify final state
4. 验证最终状态
lancer tables info docs
undefinedlancer tables info docs
undefinedBest Practices
最佳实践
1. Choose the Right Embedding Model
1. 选择合适的嵌入模型
For text-only corpora:
bash
undefined仅文本语料库:
bash
undefinedFast and efficient
快速高效
lancer ingest --text-model all-MiniLM-L6-v2 document.md
lancer ingest --text-model all-MiniLM-L6-v2 document.md
Better quality
质量更优
lancer ingest --text-model bge-base-en-v1.5 document.md
**For images or mixed content:**
```bashlancer ingest --text-model bge-base-en-v1.5 document.md
**图像或混合内容:**
```bashCross-modal search (text queries → image results)
跨模态搜索(文本查询→图像结果)
lancer ingest --embedding-model clip-vit-b-32 content/
undefinedlancer ingest --embedding-model clip-vit-b-32 content/
undefined2. Optimize Chunk Settings
2. 优化分块设置
Short documents (< 500 words):
bash
lancer ingest --chunk-size 500 --chunk-overlap 100 article.mdLong documents (> 2000 words):
bash
lancer ingest --chunk-size 2000 --chunk-overlap 400 book.pdfCode documentation:
bash
lancer ingest --chunk-size 1000 --chunk-overlap 200 docs/短文档(<500词):
bash
lancer ingest --chunk-size 500 --chunk-overlap 100 article.md长文档(>2000词):
bash
lancer ingest --chunk-size 2000 --chunk-overlap 400 book.pdf代码文档:
bash
lancer ingest --chunk-size 1000 --chunk-overlap 200 docs/3. Use Tables to Organize Content
3. 使用表组织内容
bash
undefinedbash
undefinedSeparate tables by content type
按内容类型分表存储
lancer ingest -t api_docs ./api/.md
lancer ingest -t tutorials ./tutorials/.md
lancer ingest -t images ./screenshots/*.png
lancer ingest -t api_docs ./api/.md
lancer ingest -t tutorials ./tutorials/.md
lancer ingest -t images ./screenshots/*.png
Search specific context
搜索特定上下文
lancer search -t api_docs "authentication endpoints"
undefinedlancer search -t api_docs "authentication endpoints"
undefined4. Set Appropriate Thresholds
4. 设置合适的阈值
Broad exploration:
bash
lancer search --threshold 0.4 "general topic"Precise matching:
bash
lancer search --threshold 0.75 "specific concept"Very high precision:
bash
lancer search --threshold 0.85 -l 3 "exact information"广泛探索:
bash
lancer search --threshold 0.4 "general topic"精准匹配:
bash
lancer search --threshold 0.75 "specific concept"极高精度:
bash
lancer search --threshold 0.85 -l 3 "exact information"5. Use Filters for Structured Data
5. 结合过滤条件处理结构化数据
bash
undefinedbash
undefinedCombine semantic search with metadata
语义搜索与元数据结合
lancer search
--filter "status:eq:published"
--filter "category:eq:tutorial"
--threshold 0.6
"getting started guide"
--filter "status:eq:published"
--filter "category:eq:tutorial"
--threshold 0.6
"getting started guide"
undefinedlancer search
--filter "status:eq:published"
--filter "category:eq:tutorial"
--threshold 0.6
"getting started guide"
--filter "status:eq:published"
--filter "category:eq:tutorial"
--threshold 0.6
"getting started guide"
undefined6. Format Output for Scripting
6. 格式化输出以支持脚本
bash
undefinedbash
undefinedJSON output for automation
JSON格式输出用于自动化
lancer search --format json "query" | jq '.results[] | .path'
lancer search --format json "query" | jq '.results[] | .path'
List tables programmatically
以编程方式列出表
lancer tables list --format json | jq '.[] | .name'
undefinedlancer tables list --format json | jq '.[] | .name'
undefinedMCP Server Mode
MCP服务器模式
Running as MCP Server
运行MCP服务器
bash
undefinedbash
undefinedStart MCP server for Claude Desktop integration
启动MCP服务器以集成Claude Desktop
lancer mcp
lancer mcp
With custom config
使用自定义配置
lancer mcp -c ~/.lancer/config.toml
lancer mcp -c ~/.lancer/config.toml
With specific log level
设置特定日志级别
lancer mcp --log-level info
undefinedlancer mcp --log-level info
undefinedIntegration with Claude Desktop
与Claude Desktop集成
Add to Claude Desktop config ():
~/Library/Application Support/Claude/claude_desktop_config.jsonjson
{
"mcpServers": {
"lancer": {
"command": "lancer",
"args": ["mcp"]
}
}
}添加至Claude Desktop配置文件():
~/Library/Application Support/Claude/claude_desktop_config.jsonjson
{
"mcpServers": {
"lancer": {
"command": "lancer",
"args": ["mcp"]
}
}
}Performance Tips
性能优化技巧
1. Batch Operations
1. 批量操作
bash
undefinedbash
undefinedIngest multiple files at once
同时摄入多个文件
lancer ingest file1.md file2.md file3.md
lancer ingest file1.md file2.md file3.md
Use --stdin for large batches
使用--stdin处理大量批量任务
find ./docs -name "*.md" | lancer ingest --stdin
undefinedfind ./docs -name "*.md" | lancer ingest --stdin
undefined2. Optimize Batch Size
2. 优化批量大小
bash
undefinedbash
undefinedLarger batches for bulk ingestion
批量摄入大语料库时使用更大的批量值
lancer ingest --batch-size 500 ./large-corpus/
lancer ingest --batch-size 500 ./large-corpus/
Smaller batches for limited memory
内存有限时使用更小的批量值
lancer ingest --batch-size 50 ./documents/
undefinedlancer ingest --batch-size 50 ./documents/
undefined3. Skip Embeddings for Metadata-Only
3. 仅存储元数据时跳过嵌入
bash
undefinedbash
undefinedIndex metadata without generating embeddings
仅索引元数据,不生成嵌入向量
lancer ingest --no-embeddings ./archive/
undefinedlancer ingest --no-embeddings ./archive/
undefined4. Use Appropriate Models
4. 使用合适的模型
bash
undefinedbash
undefinedFaster ingestion with smaller model
使用更小模型加速摄入
lancer ingest --text-model all-MiniLM-L6-v2 ./docs/
lancer ingest --text-model all-MiniLM-L6-v2 ./docs/
Better quality with larger model (slower)
使用更大模型提升质量(速度较慢)
lancer ingest --text-model bge-base-en-v1.5 ./docs/
undefinedlancer ingest --text-model bge-base-en-v1.5 ./docs/
undefinedTroubleshooting
故障排除
Issue: Search returns no results
问题:搜索无结果
Solutions:
bash
undefined解决方案:
bash
undefinedLower the similarity threshold
降低相似度阈值
lancer search --threshold 0.3 "query"
lancer search --threshold 0.3 "query"
Check table exists and has documents
检查表是否存在且包含文档
lancer tables list
lancer tables info my_table
lancer tables list
lancer tables info my_table
Try different search terms
尝试使用不同的搜索词
lancer search "alternative phrasing"
undefinedlancer search "alternative phrasing"
undefinedIssue: Ingestion fails for some files
问题:部分文件摄入失败
Solutions:
bash
undefined解决方案:
bash
undefinedCheck supported extensions
检查支持的文件扩展名
lancer ingest -e md,txt,pdf ./docs/
lancer ingest -e md,txt,pdf ./docs/
Set file size limits
设置文件大小限制
lancer ingest --max-file-size 100000000 ./docs/
lancer ingest --max-file-size 100000000 ./docs/
Use debug logging
使用调试日志
lancer --log-level debug ingest document.pdf
undefinedlancer --log-level debug ingest document.pdf
undefinedIssue: Low search quality
问题:搜索质量低
Solutions:
bash
undefined解决方案:
bash
undefinedUse better embedding model
使用更优的嵌入模型
lancer ingest --text-model bge-base-en-v1.5 document.md
lancer ingest --text-model bge-base-en-v1.5 document.md
Adjust chunk size
调整分块大小
lancer ingest --chunk-size 1500 --chunk-overlap 300 document.md
lancer ingest --chunk-size 1500 --chunk-overlap 300 document.md
Adjust search threshold
调整搜索阈值
lancer search --threshold 0.6 "query"
undefinedlancer search --threshold 0.6 "query"
undefinedIssue: Slow ingestion
问题:摄入速度慢
Solutions:
bash
undefined解决方案:
bash
undefinedIncrease batch size
增大批量大小
lancer ingest --batch-size 300 ./docs/
lancer ingest --batch-size 300 ./docs/
Use faster embedding model
使用更快的嵌入模型
lancer ingest --text-model all-MiniLM-L6-v2 ./docs/
lancer ingest --text-model all-MiniLM-L6-v2 ./docs/
Skip embeddings if not needed
不需要时跳过嵌入生成
lancer ingest --no-embeddings ./docs/
undefinedlancer ingest --no-embeddings ./docs/
undefinedQuick Reference
快速参考
bash
undefinedbash
undefinedIngestion
摄入
lancer ingest document.md # Ingest single file
lancer ingest -t docs ./directory/ # Ingest to specific table
lancer ingest -e md,pdf ./docs/ # Filter by extensions
lancer ingest --chunk-size 2000 document.md # Custom chunk size
lancer ingest document.md # 摄入单个文件
lancer ingest -t docs ./directory/ # 摄入至指定表
lancer ingest -e md,pdf ./docs/ # 按扩展名过滤
lancer ingest --chunk-size 2000 document.md # 自定义分块大小
Search
搜索
lancer search "query" # Search all tables
lancer search -t docs "query" # Search specific table
lancer search -l 20 "query" # Limit results
lancer search --threshold 0.7 "query" # Set similarity threshold
lancer search --filter "author:eq:John" "query" # Metadata filter
lancer search "query" # 搜索所有表
lancer search -t docs "query" # 搜索指定表
lancer search -l 20 "query" # 限制结果数量
lancer search --threshold 0.7 "query" # 设置相似度阈值
lancer search --filter "author:eq:John" "query" # 元数据过滤
Table management
表管理
lancer tables list # List all tables
lancer tables info my_table # Table information
lancer tables delete old_table # Delete table
lancer tables list # 列出所有表
lancer tables info my_table # 查看表信息
lancer tables delete old_table # 删除表
Configuration
配置
lancer -c config.toml search "query" # Use config file
lancer --log-level debug ingest doc.md # Set log level
export LANCER_TABLE=docs # Set default table
lancer -c config.toml search "query" # 使用配置文件
lancer --log-level debug ingest doc.md # 设置日志级别
export LANCER_TABLE=docs # 设置默认表
MCP server
MCP服务器
lancer mcp # Start MCP server
undefinedlancer mcp # 启动MCP服务器
undefinedCommon Patterns
常见模式
Pattern 1: Quick Documentation Search
模式1:快速文档搜索
bash
lancer search -t docs --threshold 0.7 -l 5 "how to configure authentication"bash
lancer search -t docs --threshold 0.7 -l 5 "how to configure authentication"Pattern 2: Ingest and Test
模式2:摄入并测试
bash
lancer ingest -t test_docs document.md && \
lancer search -t test_docs "key concept from document"bash
lancer ingest -t test_docs document.md && \
lancer search -t test_docs "key concept from document"Pattern 3: Find Similar Images
模式3:查找相似图像
bash
lancer search -t images --threshold 0.8 "sunset landscape photography"bash
lancer search -t images --threshold 0.8 "sunset landscape photography"Pattern 4: Batch Ingest with Verification
模式4:批量摄入并验证
bash
find ./docs -name "*.md" | lancer ingest -t docs --stdin && \
lancer tables info docsbash
find ./docs -name "*.md" | lancer ingest -t docs --stdin && \
lancer tables info docsPattern 5: Precise Technical Search
模式5:精准技术搜索
bash
lancer search -t technical_docs \
--filter "language:eq:rust" \
--threshold 0.75 \
-l 10 \
"async trait implementation patterns"bash
lancer search -t technical_docs \
--filter "language:eq:rust" \
--threshold 0.75 \
-l 10 \
"async trait implementation patterns"Summary
总结
Primary use cases:
- Semantic search across documentation
- Multi-modal search (text and images)
- Knowledge base indexing and retrieval
- Integration with Claude via MCP
Key advantages:
- Semantic similarity (not just keyword matching)
- Multi-modal support (text and images)
- Flexible metadata filtering
- Multiple embedding model options
- Fast vector search with LanceDB
Most common commands:
- - Index documents
lancer ingest document.md - - Search semantically
lancer search "query" - - Manage tables
lancer tables list - - Precise search
lancer search -t docs --threshold 0.7 "query"
主要使用场景:
- 跨文档语义搜索
- 多模态搜索(文本与图像)
- 知识库索引与检索
- 通过MCP与Claude集成
核心优势:
- 语义相似度匹配(而非仅关键词)
- 多模态支持(文本与图像)
- 灵活的元数据过滤
- 多种嵌入模型可选
- 基于LanceDB的快速向量搜索
最常用命令:
- - 索引文档
lancer ingest document.md - - 执行语义搜索
lancer search "query" - - 管理表
lancer tables list - - 精准搜索
lancer search -t docs --threshold 0.7 "query"