Skip to content

Find similar objects

How do you find similar objects in Tallyfy Answers?

The recommendation endpoint allows you to discover objects similar to a specified reference object.

This similarity search uses vector embeddings to find objects with related characteristics, which is useful for recommendation systems, content discovery, and finding related items.

How does similarity search work in Tallyfy Answers?

Tallyfy Answers uses semantic similarity to find related objects through this process:

  1. Each object’s text content is converted into vector embeddings (numerical representations)
  2. When searching for similar objects, Tallyfy compares vector distances
  3. Objects with closer vector distances are considered more similar
  4. Results are ranked by similarity score from most to least similar

API endpoint

GET /v1/collections/{collection_name}/objects/{object_id}/similar

Path parameters

ParameterTypeRequiredDescription
collection_namestringYesName of the collection to search in
object_idstringYesID of the reference object to find similar objects to

Query parameters

ParameterTypeRequiredDefaultDescription
limitintegerNo10Maximum number of similar objects to return (1-100)
min_scorefloatNo0.0Minimum similarity score threshold (0.0-1.0)
filterstringNonullFilter expression to narrow down results

Response

A successful similarity search request returns a 200 OK status code and a JSON response containing:

{
"results": [
{
"id": "product-456",
"score": 0.89,
"document": {
"name": "Bluetooth Speaker",
"description": "Portable waterproof speaker with 20-hour battery life",
"price": 129.99,
"categories": ["electronics", "audio"]
}
},
{
"id": "product-789",
"score": 0.72,
"document": {
"name": "Wireless Earbuds",
"description": "Premium noise-canceling earbuds with charging case",
"price": 99.99,
"categories": ["electronics", "audio"]
}
}
],
"meta": {
"limit": 10,
"found": 2
}
}

Response fields

FieldTypeDescription
resultsarrayList of similar objects with similarity scores
results[].idstringUnique identifier of the similar object
results[].scorefloatSimilarity score (0.0-1.0) where higher is more similar
results[].documentobjectFull content of the similar object
meta.limitintegerMaximum number of results requested
meta.foundintegerTotal number of similar objects found

Error scenarios

StatusDescription
404Collection or reference object not found
400Invalid parameters or filter syntax

Example request

Terminal window
# Find objects similar to product-123 with at least 0.7 similarity
curl -X GET "https://go.tallyfy.com/api/collections/products/objects/product-123/similar?limit=5&min_score=0.7" \
-H "X-Answers-API-Key: <your_api_key>"
  • Product recommendations: “Customers who viewed this also viewed…”
  • Content discovery: Finding related articles or documentation
  • Similarity matching: Identifying near-duplicate content
  • Alternative suggestions: Offering similar options when an item is unavailable
  • Start with a lower min_score threshold and adjust based on result quality
  • Use the filter parameter to combine similarity with business rules
  • For better recommendations, ensure your objects contain rich, descriptive text
  • Include diverse object attributes to improve similarity matching accuracy

Objects > Get an object

The Tallyfy Answers API provides a GET endpoint that retrieves individual objects from collections using their unique identifier and returns complete object data with all properties including system-generated timestamps.

Objects > Delete an object

The DELETE endpoint permanently removes specific objects from Tallyfy Answers collections using unique identifiers with no recovery option and returns confirmation upon successful deletion.

Answers > Collections

Tallyfy Answers collections are organizational structures that function like database tables to group related objects together while providing dynamic schema detection searchability and complete management capabilities for efficient data organization and retrieval.

Answers > Objects

Objects in Tallyfy Answers are fundamental JSON-formatted data records that belong to collections and can be indexed retrieved and searched with flexible schemas that automatically detect properties and support both custom and auto-generated unique identifiers.