Highlights working for research collection but not...
# community-help
r
Highlights working for research collection but not notes collection in production Hi Typesense community! I have a puzzling issue where search highlights work for one collection but not another in production, while both work fine locally. Both environments use the same Firestore database, so data differences are ruled out. Setup: • Two collections: "notes" and "research" • Both local and production use the same Firestore database • Using
highlight_full_fields
parameter for both • Same search configuration pattern for both collections Working (Both Local & Production):
Copy code
// Research collection - highlights work everywhere
const researchParams = {
  collection: "research",
  query_by: "name,tags,fullText,embedding",
  highlight_full_fields: "name",
  // ... other params
};
Not Working (Local works, Production doesn't):
Copy code
// Notes collection - highlights work locally but not in production
const notesParams = {
  collection: "notes", 
  query_by: "title,tags,content,embedding",
  highlight_full_fields: "title",
  // ... other params
};
Expected Response (Notes - Local):
Copy code
{
  "hits": [
    {
      "document": {
        "id": "note-123",
        "title": "Market Analysis Report"
      },
      "highlights": [
        {
          "field": "title",
          "matched_tokens": [
            "Market",
            "Analysis"
          ],
          "snippet": "<mark>Market</mark> <mark>Analysis</mark> Report"
        }
      ]
    }
  ]
}
Actual Response (Notes - Production):
Copy code
{
  "hits": [
    {
      "document": {
        "id": "note-123",
        "title": "Market Analysis Report"
      },
      "highlights": [] // Empty array
    }
  ]
}
Key Observations: Same Firestore database in both environments Research collection highlights work in both environments Notes collection highlights work locally Notes collection highlights fail in production Both collections return search results correctly Same Typesense configuration and version Questions: • Could this be related to how the notes collection was indexed in production vs local Typesense instances? • Are there any environment-specific Typesense configurations that could affect highlighting for specific collections? • Could there be differences in the notes collection schema or indexing between the two Typesense instances? • Are there any known issues with
highlight_full_fields
on certain field types when using different Typesense instances? The fact that both environments use the same data source but have different highlighting behavior suggests it's a Typesense indexing or configuration issue specific to the notes collection. Any insights would be helpful!
f
Could you share the network request and the response coming from each environment? There may be a different set of parameters for each.
r
Deployed Site: Request URL: https://search.dev-portal.variantperception.com/multi_search Payload:
Copy code
{
  "searches": [
    {
      "include_fields": "id,title,topic,publishedAt,slug",
      "q": "test",
      "page": 1,
      "collection": "notes",
      "query_by": "title",
      "sort_by": "publishedAt:desc,_text_match:desc",
      "per_page": 100,
      "highlight_full_fields": "title"
    },
    {
      "include_fields": "id,title,topic,publishedAt,slug",
      "q": "test",
      "page": 1,
      "collection": "notes",
      "query_by": "title,tags,content,embedding",
      "sort_by": "publishedAt:desc,_text_match:desc,_vector_distance:asc",
      "query_by_weights": "10,2,1,5",
      "per_page": 30,
      "highlight_full_fields": "title",
      "vector_query": "embedding:([], distance_threshold:0.15)"
    }
  ]
}
Deployed site(Dev Portal) Request URL: https://tdlkwpms10oc6e84p-1.a1.typesense.net/multi_search Payload:
Copy code
{
  "searches": [
    {
      "include_fields": "id,title,topic,publishedAt,slug",
      "q": "test",
      "page": 1,
      "collection": "notes",
      "query_by": "title",
      "sort_by": "publishedAt:desc,_text_match:desc",
      "per_page": 100,
      "highlight_full_fields": "title"
    },
    {
      "include_fields": "id,title,topic,publishedAt,slug",
      "q": "test",
      "page": 1,
      "collection": "notes",
      "query_by": "title,tags,content,embedding",
      "sort_by": "publishedAt:desc,_text_match:desc,_vector_distance:asc",
      "query_by_weights": "10,2,1,5",
      "per_page": 30,
      "highlight_full_fields": "title",
      "vector_query": "embedding:([], distance_threshold:0.15)"
    }
  ]
}
Hi Fancis, thanks for your reply. I have shared the requests and responses.
f
Are you self-hosting or are you using Typesense cloud?
r
I am using Typesense cloud
f
For both local development and your production environment?
r
Yes,
image.png
Can you help me here?
f
Hey, the fiel you posted isn't found. Also, Typesense is deterministic, sending the same API request will always net the same results, so the highlights should be exactly the same between the two