Skip to content
SolidRusT.ai

Hybrid Search

Hybrid search combines semantic vector similarity with knowledge graph traversal for comprehensive results. It extracts entities from your query using a dictionary-based extractor, runs both vector and graph searches, then merges, deduplicates, and re-scores results.

POST https://api.solidrust.ai/data/v1/query/hybrid
  1. Entity extraction — Extract entities from the query text (dictionary-based, no LLM)
  2. Vector search — Semantic similarity search in Milvus
  3. Graph traversal — For each extracted entity, traverse Neo4j knowledge graph
  4. Document resolution — Resolve graph entities to Milvus documents
  5. Merge & re-score — Combine results with configurable weights, deduplicate, sort
ParameterTypeRequiredDefaultDescription
querystring✅ YesThe search query text
semantic_weightfloatNo0.7Weight for semantic results (0.0–1.0)
graph_weightfloatNo0.3Weight for graph results (0.0–1.0)
sourcesstring[]NoallFilter results to specific sources
entity_booststring[]NoEntity names to boost in results
limitintegerNo10Maximum results (1–100)
use_entity_extractionbooleanNotrueExtract entities from query text
gamestringNoGame domain for extraction (e.g. eve)
use_graphbooleanNotrueEnable Neo4j graph traversal
graph_depthintegerNo2Max graph traversal depth (1–5)
Terminal window
curl -X POST "https://api.solidrust.ai/data/v1/query/hybrid" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "Python SDK authentication",
"semantic_weight": 0.7,
"graph_weight": 0.3,
"use_graph": true,
"graph_depth": 2,
"limit": 10
}'
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.solidrust.ai"
def hybrid_search(
query: str,
semantic_weight: float = 0.7,
graph_weight: float = 0.3,
entity_boost: list[str] | None = None,
game: str | None = None,
limit: int = 10,
) -> dict:
"""Combined semantic and knowledge graph search."""
payload = {
"query": query,
"semantic_weight": semantic_weight,
"graph_weight": graph_weight,
"limit": limit,
}
if entity_boost:
payload["entity_boost"] = entity_boost
if game:
payload["game"] = game
payload["use_entity_extraction"] = True
response = requests.post(
f"{BASE_URL}/data/v1/query/hybrid",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json=payload,
)
return response.json()
results = hybrid_search(
query="How to use Python SDK for embeddings",
semantic_weight=0.7,
graph_weight=0.3,
entity_boost=["Python", "embeddings"],
)
print(f"Found {results['total']} results (vector={results['vector_count']}, graph={results['graph_count']})")
for r in results["results"]:
print(f"\nScore: {r['score']:.2f} [{r['origin']}]")
print(f" {r['title']}")
print(f" {r['content'][:150]}...")
async function hybridSearch(query, options = {}) {
const payload = {
query,
semantic_weight: options.semanticWeight ?? 0.7,
graph_weight: options.graphWeight ?? 0.3,
limit: options.limit ?? 10,
};
if (options.entityBoost) payload.entity_boost = options.entityBoost;
if (options.game) { payload.game = options.game; payload.use_entity_extraction = true; }
const res = await fetch(`${BASE_URL}/data/v1/query/hybrid`, {
method: 'POST',
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
return res.json();
}
{
"query": "Python SDK authentication",
"entities_found": ["Python", "authentication"],
"results": [
{
"id": "chunk-xyz",
"title": "Python SDK Authentication",
"content": "The Python SDK supports authentication via API key...",
"source": "api-docs",
"source_id": "python-auth",
"content_type": "docs",
"url": "https://docs.solidrust.ai/sdks/python",
"score": 0.92,
"origin": "both"
}
],
"total": 1,
"vector_count": 3,
"graph_count": 2,
"merged_count": 1,
"latency_ms": 128.5
}
Use Casesemantic_weightgraph_weightWhy
Concept questions0.90.1Semantic understanding matters most
Entity exploration0.30.7Graph relationships reveal connections
Balanced (default)0.70.3Good general-purpose mix
Code/API questions0.80.2Prefer semantic match for technical content
StatusCodeDescription
400invalid_requestMissing or invalid parameters
401INVALID_API_KEYMissing or invalid API key
429RATE_LIMIT_EXCEEDEDToo many requests
500internal_errorSearch pipeline failure