he search¶
Perform semantic search over a knowledge abstract.
Synopsis¶
Arguments¶
| Argument | Description |
|---|---|
KA_PATH |
Path to knowledge abstract directory |
QUERY |
Search query string |
Options¶
| Option | Short | Description | Default |
|---|---|---|---|
--top-k |
-n |
Number of results to return | 3 |
Description¶
Semantic search finds relevant information even when keywords don't match exactly. It uses:
- Vector embeddings — Converts query and content to vectors
- Similarity matching — Finds semantically similar content
- Ranking — Returns most relevant results
Requires: Search index must be built. Run he build-index if needed.
Examples¶
Basic Search¶
Get More Results¶
Natural Language Queries¶
he search ./ka/ "What were the major achievements?"
he search ./ka/ "People who worked with Edison"
he search ./ka/ "Important dates in the timeline"
After Building Index¶
# First, ensure index exists
he build-index ./output/
# Then search
he search ./output/ "innovation"
Output Format¶
Found 3 result(s):
Result 1:
{
"name": "Nikola Tesla",
"type": "person",
"description": "Serbian-American inventor, electrical engineer..."
}
Result 2:
{
"source": "Nikola Tesla",
"target": "Thomas Edison",
"type": "worked_with",
"description": "Tesla worked for Edison in 1884"
}
Result 3:
...
How It Works¶
- Query Embedding — Converts your query to a vector
- Index Search — Finds nearest vectors in the knowledge abstract
- Result Ranking — Returns top-k most similar items
Tips for Better Search¶
- Use natural language — "inventions in electrical engineering" vs "invention electrical"
- Be specific — "Tesla's work on AC power" vs "Tesla work"
- Try synonyms — If "inventions" doesn't work, try "discoveries"
- Increase top-k — Use
-n 10for broader results
Comparison with he talk¶
| Feature | he search |
he talk |
|---|---|---|
| Returns | Raw entities/relations | Natural language answer |
| Use case | Find specific data | Get explanations |
| Speed | Faster | Slower (LLM generation) |
| Precision | Exact matches | Interpretive |
Troubleshooting¶
"Index not found"¶
Build the search index:
"No results found"¶
Try:
1. Broader query terms
2. Increase -n for more results
3. Different phrasing
4. Check he info ./output/ to verify data exists
See Also¶
he talk— Chat with knowledge abstracthe build-index— Build search indexhe parse— Extract with index building