lancer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Lancer - LanceDB CLI and MCP Server Skill

Lancer - LanceDB CLI与MCP Server Skill

You are a specialist in using
lancer
, 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提供了文档摄入、搜索与表管理的完整工作流、最佳实践及常见模式。

What is Lancer?

什么是Lancer?

lancer
is a powerful tool for:
  • 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

核心功能

  1. Ingest: Add documents to LanceDB with automatic chunking and embedding
  2. Search: Semantic similarity search across documents
  3. Tables: Manage LanceDB tables (list, info, delete)
  4. Remove: Remove documents from tables
  5. MCP: Run as Model Context Protocol server
  1. 摄入:自动完成分块与嵌入,将文档添加至LanceDB
  2. 搜索:跨文档执行语义相似度搜索
  3. 表管理:管理LanceDB表(列出、查看信息、删除)
  4. 移除:从表中删除文档
  5. MCP服务:以模型上下文协议(Model Context Protocol)服务器模式运行

Quick Start

快速开始

Basic Search

基础搜索

bash
undefined
bash
undefined

Search 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"
undefined
lancer search --threshold 0.7 "error handling patterns"
undefined

Basic Ingestion

基础摄入

bash
undefined
bash
undefined

Ingest 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/
undefined
lancer ingest file1.md file2.pdf ./images/
undefined

Document Ingestion

文档摄入

Ingest Command Options

摄入命令选项

bash
undefined
bash
undefined

Ingest 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
undefined
lancer ingest --chunk-size 2000 --chunk-overlap 400 document.md
undefined

Supported File Types

支持的文件类型

Text formats:
  • txt
    - Plain text files
  • md
    - Markdown documents
  • pdf
    - PDF documents
  • sql
    - SQL scripts
Image formats:
  • jpg
    ,
    jpeg
    - JPEG images
  • png
    - PNG images
  • gif
    - GIF images
  • bmp
    - Bitmap images
  • webp
    - WebP images
  • tiff
    ,
    tif
    - TIFF images
  • svg
    - SVG vector graphics
  • ico
    - Icon files
文本格式:
  • txt
    - 纯文本文件
  • md
    - Markdown文档
  • pdf
    - PDF文档
  • sql
    - SQL脚本
图像格式:
  • jpg
    ,
    jpeg
    - JPEG图像
  • png
    - PNG图像
  • gif
    - GIF图像
  • bmp
    - 位图图像
  • webp
    - WebP图像
  • tiff
    ,
    tif
    - TIFF图像
  • svg
    - SVG矢量图形
  • ico
    - 图标文件

Embedding Models

嵌入模型

Text models:
bash
undefined
文本模型:
bash
undefined

Default: 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:**
```bash
lancer ingest --text-model bge-small-en-v1.5 document.md lancer ingest --text-model bge-base-en-v1.5 document.md

**图像模型:**
```bash

Default: 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:**
```bash
lancer ingest --image-model resnet50 image.jpg

**进阶:强制使用指定模型**
```bash

Force 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
undefined
lancer ingest --embedding-model BAAI/bge-small-en-v1.5 document.md
undefined

Ingestion Optimization

摄入优化

bash
undefined
bash
undefined

Filter 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
undefined
lancer ingest --format json document.md
undefined

Search Operations

搜索操作

Search Command Options

搜索命令选项

bash
undefined
bash
undefined

Basic 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"
undefined
lancer search --format json "machine learning"
undefined

Metadata Filters

元数据过滤

bash
undefined
bash
undefined

Single 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"
lancer search
--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(字符串包含)

undefined
undefined

Search Examples

搜索示例

bash
undefined
bash
undefined

Find recent documentation

查找最新文档

lancer search
-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"

Search by category

按分类搜索

lancer search
--filter "category:eq:tutorial"
"getting started"
lancer search
--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"
undefined
lancer search
-t technical_docs
--filter "language:eq:python"
--filter "level:eq:advanced"
--threshold 0.7
-l 15
"async programming patterns"
undefined

Table Management

表管理

List Tables

列出表

bash
undefined
bash
undefined

List all tables

列出所有表

lancer tables list
lancer tables list

JSON output

以JSON格式输出

lancer tables list --format json
undefined
lancer tables list --format json
undefined

Table Information

表信息

bash
undefined
bash
undefined

Get table details

获取表详情

lancer tables info my_table
lancer tables info my_table

JSON output for scripting

以JSON格式输出(用于脚本)

lancer tables info my_table --format json
undefined
lancer tables info my_table --format json
undefined

Delete Table

删除表

bash
undefined
bash
undefined

Delete a table (be careful!)

删除表(操作请谨慎!)

lancer tables delete old_table
undefined
lancer tables delete old_table
undefined

Remove Documents

移除文档

bash
undefined
bash
undefined

Remove 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
undefined
lancer remove -t docs id1 id2 id3
undefined

Configuration

配置

Using Config File

使用配置文件

bash
undefined
bash
undefined

Specify 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
undefined
lancer -c config.toml ingest document.md
undefined

Environment Variables

环境变量

bash
undefined
bash
undefined

Set 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
undefined
export LANCER_LOG_LEVEL=debug lancer ingest document.md
undefined

Log Levels

日志级别

bash
undefined
bash
undefined

Error 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"
undefined
lancer --log-level trace search "query"
undefined

Common Workflows

常见工作流

Workflow 1: Index Documentation

工作流1:索引文档

bash
undefined
bash
undefined

1. 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"
undefined
lancer search -t docs --threshold 0.7 -l 5 "configuration"
undefined

Workflow 2: Multi-modal Image Search

工作流2:多模态图像搜索

bash
undefined
bash
undefined

1. Ingest images with CLIP model

1. 使用CLIP模型摄入图像

lancer ingest -t images -e jpg,png,webp
--image-model clip-vit-b-32
./photos/
lancer ingest -t images -e jpg,png,webp
--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"
undefined
lancer search -t images --threshold 0.8 "red car"
undefined

Workflow 3: Mixed Content Corpus

工作流3:混合内容语料库

bash
undefined
bash
undefined

1. 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/
lancer ingest -t knowledge_base
--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"
undefined
lancer search -t knowledge_base
--filter "file_type:eq:png"
"system design"
undefined

Workflow 4: Batch Ingestion

工作流4:批量摄入

bash
undefined
bash
undefined

1. 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
lancer ingest -t corpus
--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"
undefined
lancer search -t corpus -l 10 "sample query"
undefined

Workflow 5: Update Existing Corpus

工作流5:更新现有语料库

bash
undefined
bash
undefined

1. 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
undefined
lancer tables info docs
undefined

Best Practices

最佳实践

1. Choose the Right Embedding Model

1. 选择合适的嵌入模型

For text-only corpora:
bash
undefined
仅文本语料库:
bash
undefined

Fast 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:**
```bash
lancer ingest --text-model bge-base-en-v1.5 document.md

**图像或混合内容:**
```bash

Cross-modal search (text queries → image results)

跨模态搜索(文本查询→图像结果)

lancer ingest --embedding-model clip-vit-b-32 content/
undefined
lancer ingest --embedding-model clip-vit-b-32 content/
undefined

2. Optimize Chunk Settings

2. 优化分块设置

Short documents (< 500 words):
bash
lancer ingest --chunk-size 500 --chunk-overlap 100 article.md
Long documents (> 2000 words):
bash
lancer ingest --chunk-size 2000 --chunk-overlap 400 book.pdf
Code 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
undefined
bash
undefined

Separate 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"
undefined
lancer search -t api_docs "authentication endpoints"
undefined

4. 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
undefined
bash
undefined

Combine semantic search with metadata

语义搜索与元数据结合

lancer search
--filter "status:eq:published"
--filter "category:eq:tutorial"
--threshold 0.6
"getting started guide"
undefined
lancer search
--filter "status:eq:published"
--filter "category:eq:tutorial"
--threshold 0.6
"getting started guide"
undefined

6. Format Output for Scripting

6. 格式化输出以支持脚本

bash
undefined
bash
undefined

JSON 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'
undefined
lancer tables list --format json | jq '.[] | .name'
undefined

MCP Server Mode

MCP服务器模式

Running as MCP Server

运行MCP服务器

bash
undefined
bash
undefined

Start 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
undefined
lancer mcp --log-level info
undefined

Integration with Claude Desktop

与Claude Desktop集成

Add to Claude Desktop config (
~/Library/Application Support/Claude/claude_desktop_config.json
):
json
{
  "mcpServers": {
    "lancer": {
      "command": "lancer",
      "args": ["mcp"]
    }
  }
}
添加至Claude Desktop配置文件(
~/Library/Application Support/Claude/claude_desktop_config.json
):
json
{
  "mcpServers": {
    "lancer": {
      "command": "lancer",
      "args": ["mcp"]
    }
  }
}

Performance Tips

性能优化技巧

1. Batch Operations

1. 批量操作

bash
undefined
bash
undefined

Ingest 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
undefined
find ./docs -name "*.md" | lancer ingest --stdin
undefined

2. Optimize Batch Size

2. 优化批量大小

bash
undefined
bash
undefined

Larger 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/
undefined
lancer ingest --batch-size 50 ./documents/
undefined

3. Skip Embeddings for Metadata-Only

3. 仅存储元数据时跳过嵌入

bash
undefined
bash
undefined

Index metadata without generating embeddings

仅索引元数据,不生成嵌入向量

lancer ingest --no-embeddings ./archive/
undefined
lancer ingest --no-embeddings ./archive/
undefined

4. Use Appropriate Models

4. 使用合适的模型

bash
undefined
bash
undefined

Faster 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/
undefined
lancer ingest --text-model bge-base-en-v1.5 ./docs/
undefined

Troubleshooting

故障排除

Issue: Search returns no results

问题:搜索无结果

Solutions:
bash
undefined
解决方案:
bash
undefined

Lower 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"
undefined
lancer search "alternative phrasing"
undefined

Issue: Ingestion fails for some files

问题:部分文件摄入失败

Solutions:
bash
undefined
解决方案:
bash
undefined

Check 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
undefined
lancer --log-level debug ingest document.pdf
undefined

Issue: Low search quality

问题:搜索质量低

Solutions:
bash
undefined
解决方案:
bash
undefined

Use 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"
undefined
lancer search --threshold 0.6 "query"
undefined

Issue: Slow ingestion

问题:摄入速度慢

Solutions:
bash
undefined
解决方案:
bash
undefined

Increase 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/
undefined
lancer ingest --no-embeddings ./docs/
undefined

Quick Reference

快速参考

bash
undefined
bash
undefined

Ingestion

摄入

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
undefined
lancer mcp # 启动MCP服务器
undefined

Common 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 docs
bash
find ./docs -name "*.md" | lancer ingest -t docs --stdin && \
lancer tables info docs

Pattern 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:
  • lancer ingest document.md
    - Index documents
  • lancer search "query"
    - Search semantically
  • lancer tables list
    - Manage tables
  • lancer search -t docs --threshold 0.7 "query"
    - Precise search
主要使用场景:
  • 跨文档语义搜索
  • 多模态搜索(文本与图像)
  • 知识库索引与检索
  • 通过MCP与Claude集成
核心优势:
  • 语义相似度匹配(而非仅关键词)
  • 多模态支持(文本与图像)
  • 灵活的元数据过滤
  • 多种嵌入模型可选
  • 基于LanceDB的快速向量搜索
最常用命令:
  • lancer ingest document.md
    - 索引文档
  • lancer search "query"
    - 执行语义搜索
  • lancer tables list
    - 管理表
  • lancer search -t docs --threshold 0.7 "query"
    - 精准搜索