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 /collections/{collection_name}/recommend/{object_id}

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
limitintegerNo4Maximum number of similar objects to return (1-20)

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)1 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 article-123, limit to 5 results
curl -X GET "https://answers.tallyfy.com/collections/docs/recommend/article-123?limit=5" \
-H "Authorization: Bearer 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

Answers > Collections

Collections in Tallyfy Answers are organizational structures that group similar objects together like database tables and provide features for searching filtering and managing data with automatic schema detection and complete CRUD operations.

Objects > Get an object

The Tallyfy Answers API endpoint retrieves complete individual object data from collections using unique identifiers through a GET request that returns full object properties including system-generated timestamps.

Answers > Search

Tallyfy Answers search combines AI semantic understanding with traditional keyword matching to deliver relevant results through natural language queries and exact term searches with smart filtering and instant results.

Objects > Delete an object

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

Footnotes

  1. Cosine similarity scoring where perfect match equals 1.0, high similarity above 0.8, low below 0.5