Skip to main content
POST
/
db
/
hybrid-search
JavaScript
const url = 'https://api.worqhat.com/db/hybrid-search';
const options = {
  method: 'POST',
  headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
  body: '{"query":"machine learning algorithms neural networks","table":"products","text_columns":["title","description","tags"],"semantic_weight":0.7,"keyword_weight":0.3,"limit":10,"environment":"production"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
{
  "success": true,
  "results": [
    {
      "record": {},
      "combined_score": 0.823,
      "semantic_score": 0.756,
      "keyword_score": 0.234,
      "_meta": {
        "search_type": "hybrid",
        "weights": {
          "semantic": 0.7,
          "keyword": 0.3
        }
      }
    }
  ],
  "query_embedding_preview": [
    0.123,
    -0.456,
    0.789,
    -0.321,
    0.654
  ],
  "executionTime": 312
}

Authorizations

Authorization
string
header
required

API key authentication. Format - "Bearer YOUR_API_KEY"

Body

application/json
query
string
required

Search query combining natural language and keywords

Example:

"machine learning algorithms neural networks"

table
string
required

Table to search in

Example:

"products"

text_columns
string[]

Columns to include in keyword search

Example:
["title", "description", "tags"]
semantic_weight
number
default:0.7

Weight for semantic similarity score

Required range: 0 <= x <= 1
keyword_weight
number
default:0.3

Weight for keyword matching score

Required range: 0 <= x <= 1
limit
number
default:10

Maximum number of results to return

Required range: 1 <= x <= 100
environment
enum<string>

Environment to search in (development, staging, production)

Available options:
development,
staging,
production
Example:

"production"

Response

Hybrid search completed successfully

success
boolean
Example:

true

results
object[]
query_embedding_preview
number[]

First 5 dimensions of the query embedding

Example:
[0.123, -0.456, 0.789, -0.321, 0.654]
executionTime
number

Search execution time in milliseconds

Example:

312