Issue with Filter_by Negation Providing Few Results

TLDR Dan was having problems obtaining expected results with a filter_by negation on array field. Kishore Nallan couldn’t recreate the problem, suggested to provide additional sample data.

Powered by Struct AI


Aug 17, 2023 (3 months ago)
Photo of md5-5f114bcaa05d5c832038d78174f2060d
01:25 PM
Hi, we’re trying to do a filter_by negation on an array field, it only returns very few results but not all the results. Are we doing something wrong with the query? Let me know if you need any additional info from us? This is the query we’re testing. It’s a large collection and hide_for_user is empty for most. So we’re expecting 100 results give the per_page param, but it’s only returning a few.
  "q": "*",
  "query_by": "full_name",
  "filter_by": "hide_for_user:!=[user3]",
  "page": 1,
  "per_page": 100,
  "exhaustive_search": true
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:32 PM
Can you please tell me the type of hide_for_user field?
Photo of md5-5f114bcaa05d5c832038d78174f2060d
01:34 PM
    }, {
        "name": "hide_for_user",
        "type": "string[]",
        "optional": True,
        "index": True,
        "facet": True
    }, {
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:35 PM
Let me check and get back to you


Kishore Nallan
02:42 PM
I just tried this on a quick sample data, but the negation filter seems to be working fine :thinking_face:

Maybe there's an edge case that we didn't account for. Would you be able to come up with a small reproduceable example? That would help us figure out what's going wrong.
Kishore Nallan
02:43 PM
> empty for most.
Actually this could be the issue. Let me try with some example with missing data.
Kishore Nallan
02:45 PM
Nope, that works fine as well. I need a small reproduceable example to investigate this.
Photo of md5-5f114bcaa05d5c832038d78174f2060d
04:21 PM
what’s the best way to share this with you? could we share access to our test server or do you want sample data
Aug 18, 2023 (3 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:39 AM
Ideally to debug what's happening we need sample data. You can provide an export of the collection, collection schema and query.


Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3005 threads (79% resolved)

Join Our Community

Similar Threads

Trouble with 'q' Parameter in Typesense query

ryosuke_shiomi was having trouble with a Typesense query involving the 'q' parameter. Kishore Nallan suggested a temporary workaround and proposed using the latest builds to fix the issue. The solution was under trial at the end of the thread.


Performance Characteristics of Filtering Search Results

Oskar queries the performance difference in filtering search results. Jason clarifies how filters work and provides performance improvement suggestions like increasing vCPUs and sharding the collection. Kishore Nallan explains filter IDs and document ID matching. The thread concludes with discussions on performance tradeoffs in filter implementation.


Phrase Search Relevancy and Weights Fix

Jan reported an issue with phrase search relevancy using Typesense Instantsearch Adapter. The problem occurred when searching phrases with double quotes. The team identified the issue to be related to weights and implemented a fix, improving the search results.



Methods for Fetching, Querying, and Modifying Collections in Typesense

Bill inquired about performing OR queries, querying empty arrays and modifying collections in Typesense. Kishore Nallan explained the current limitations and provided workarounds and recommendations for each case. The conversation also touched upon the usage of cache in Typesense and the workings of the _eval function.



Fixing Multiple Document Retrieval in Typesense

Phil needed an efficient way to retrieve multiple documents by id. Kishore Nallan proposed a solution available in a pre-release build. After some bug fixing regarding id matching by Jason and Kishore Nallan, Phil successfully tested the solution.