Hello everyone! I've a problem with facets, filter...
# community-help
d
Hello everyone! I've a problem with facets, filters and vector search. I make 2 separate queries: one for facets and one for the search results. Here's the first query for facets (without any filter):
Copy code
{
  "query_by": "embedding,title,content",
  "vector_query": "embedding:([], alpha: 0.5, distance_threshold: 0.8, k: 200)",
  "per_page": 0,
  "group_by": "itemId",
  "facet_by": "template,extension",
  "collection": "xxx_it-IT",
  "exclude_fields": "embedding",
  "q": "template mappa organizzativa",
  "prefix": false,
  "highlight_fields": "none",
  "highlight_full_fields": "none",
  "filter_by": ""
}
The first facet I get in the response is
Copy code
"count": 78,
"value": "InternalDocument"
Here's the query to get the search results:
Copy code
{
  "query_by":"embedding,title,content",
  "vector_query":"embedding:([], alpha: 0.5, distance_threshold: 0.8, k: 200)",
  "q":"template mappa organizzativa",  
  "per_page":12",
  "page": 1,
  "highlight_fields":"title,content",
  "highlight_full_fields":"none",
  "highlight_affix_num_tokens":15,
  "prefix":false,
  "exclude_fields":"embedding,content",
  "group_by":"itemId",
  "collection":"xxx_it-IT",
  "filter_by":""
}
I get
Copy code
"found": 164
results. If I add a filter of a faceted field, the new query for the results become:
Copy code
{
  "query_by": "embedding,title,content",
  "vector_query": "embedding:([], alpha: 0.5, distance_threshold: 0.8, k: 200)",
  "q": "template mappa organizzativa",
  "per_page": 12,
  "page": 1,
  "highlight_fields": "title,content",
  "highlight_full_fields": "none",
  "highlight_affix_num_tokens": 15,
  "prefix": false,
  "exclude_fields": "embedding,content",
  "group_by": "itemId",
  "collection": "xxx_it-IT",
  "filter_by": "template:=[InternalDocument]"
}
Now I get
Copy code
"found": 144
results. I verified that all of the results are with template = InternalDocument. My question is why as the facet count I get 78 results and when I search with the template filter for the same facet value I get 144 results. Have you any suggestions about that?