Filters with multiple spaces issue

In the Algolia dashboard the following filter works:

{ “filters”: “(object_type:legacy_event_article OR object_type:legacy_article OR object_type:videos) AND event_name:“some text here works”” }

However when we try the exact same query using the js client we get no results:

       var filters = '(object_type:legacy_event_article OR object_type:legacy_article OR object_type:videos) AND event_name:"some text here works"'

        const result = await index.search(
            {
                query: '',
                filters: filters,
                offset: offset,
                length: limit,
                hitsPerPage: limit,
                maxValuesPerFacet: MAX_NUM_RESULTS
            }
        );

Here is what is really weird. If we query an event_name where the value has a single space like “some text” both the console and the js client return the same expected results. As soon as we search for an event_name where the value has more than one space like “some text works” only the query in the console works and the query from the js client returns no results. We have tried everything; using single instead of double quotes and escaping double quotes but with no luck so hopefully someone can help out.

1 Like

Found the issue. Bang head on table. The offset in the query used in the code was throwing off the results.

1 Like

D’oh!

Thanks for posting how you resolved!