Floreal Logo
SearchSearch Methods

Run Sparse Search

Find candidates with exact keyword matches and technical terms.

Sparse search uses BM25 algorithm to find exact keyword matches in CVs, making it ideal for technical skill searches and specific terminology.


✅ Good for:

  • Exact keyword matching: "Python, FastAPI, PostgreSQL, Docker"
  • Technical skills and certifications: "AWS Solutions Architect", "PMP certified"
  • Specific tools and technologies: "Jira, Confluence, Kubernetes"
  • Company names: "worked at Google or Meta"
  • Acronyms and abbreviations: "CI/CD", "REST API", "ML/AI"

❌ Not ideal for:

  • Natural language queries (use Dense Search instead)
  • Conceptual matching: "someone who can lead teams"
  • Queries with typos or synonyms

How It Works

  1. Tokenization - Breaks query into keywords and calculates term importance
  2. BM25 Matching - Finds CVs containing those exact terms using sparse vectors
  3. Ranked Results - Returns top matches ordered by keyword relevance score

Processing time: 5 to 10 seconds


Request Parameters

ParameterTypeRequiredDescription
querystringYesKeyword search query (1 to 500 characters). Use comma-separated terms.
top_kintegerNoNumber of results to return (1 to 100, default: 20)
searchGroupIdstring (UUID)NoGroup this search with others for comparison

Response Flow

This endpoint returns immediately with a searchId. The actual search runs asynchronously in the background.

Next steps:

  1. Save the returned searchId
  2. Poll GET /v1/public/searches/:searchId every 2 to 3 seconds
  3. When status is "completed", fetch results from GET /v1/public/searches/:searchId/results

Rate limit

For rate limit, please check the rate limit in the dedicated API documentation section.

Example Request

POST /v1/public/searches/sparse

{
  "query": "Python, FastAPI, PostgreSQL, Docker, Kubernetes, AWS",
  "top_k": 20
}

Example Response

202 Accepted

{
  "searchId": "550e8400-e29b-41d4-a716-446655440000",
  "searchGroupId": "660e8400-e29b-41d4-a716-446655440000",
  "status": "processing",
  "searchType": "sparse",
  "query": "Python, FastAPI, PostgreSQL, Docker, Kubernetes, AWS",
  "estimatedTime": "5 to 10 seconds",
  "statusUrl": "/v1/public/searches/550e8400-e29b-41d4-a716-446655440000",
  "resultsUrl": "/v1/public/searches/550e8400-e29b-41d4-a716-446655440000/results"
}

Tips for Better Results

  • Use comma-separated keywords: "React, TypeScript, Node.js" works better than "React TypeScript Node.js"
  • Include exact terms: Spell out acronyms when relevant ("Continuous Integration" vs "CI")
  • List required and nice-to-have skills: Put must-haves first
  • Use specific names: "Stanford University" instead of "top university"

Sparse vs Dense Comparison

FeatureSparse SearchDense Search
AlgorithmBM25 keyword matchingSemantic embeddings
Best forExact terms, technical skillsConcepts, natural language
Query styleKeywords, comma-separatedFull sentences, descriptions
Handles typosNoYes
Handles synonymsNoYes
SpeedFast (5-10 seconds)Fast (5-10 seconds)

Example comparison:

Good for Sparse:

  • "Python, FastAPI, PostgreSQL, Docker"
  • "AWS certified solutions architect"
  • "Stanford University Computer Science"

Better for Dense:

  • "someone who can build scalable backend systems"
  • "team player with leadership potential"
  • "creative problem solver"

Error Responses

StatusReasonSolution
400Invalid query formatCheck query length (1 to 500 chars) and top_k range (1 to 100)
401Invalid API keyVerify your API key in request headers
500Search initiation failedRetry request or contact support with searchId

Result Expiration

  • Search results are stored in the database and can be retrieved anytime using the same searchId

Comparing Algorithms

Use searchGroupId to run the same query with different algorithms and compare results:

# Run sparse search
POST /v1/public/searches/sparse
{ "query": "Python, Docker, AWS", "searchGroupId": "abc-123" }

# Run dense search with same groupId
POST /v1/public/searches/dense
{ "query": "Python, Docker, AWS", "searchGroupId": "abc-123" }

# Compare results
GET /v1/public/searches/groups/abc-123/results
POST
/v1/public/searches/sparse
X-API-Key<token>

API key for public API access. Get yours at https://app.floreal.ai?tab=api

In: header

querystring
Length1 <= length <= 500
searchGroupId?string | null
top_k?integer | null
Range1 <= value <= 100

Response Body

curl -X POST "https://api.floreal.ai/v1/public/searches/sparse" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "string"
  }'
{
  "searchId": "550e8400-e29b-41d4-a716-446655440000",
  "searchGroupId": "660e8400-e29b-41d4-a716-446655440000",
  "status": "processing",
  "searchType": "sparse",
  "query": "Python, FastAPI, PostgreSQL, Docker, Kubernetes",
  "estimatedTime": "5 to 10 seconds",
  "statusUrl": "/v1/public/searches/550e8400-e29b-41d4-a716-446655440000",
  "resultsUrl": "/v1/public/searches/550e8400-e29b-41d4-a716-446655440000/results"
}
{
  "error": "string",
  "message": "string"
}
{
  "error": "string"
}
{
  "error": "string",
  "message": "string"
}