Skip to content

[BUG] Redis Search silently fails to Sort when the index schema is too large #4494

@claridgicus

Description

@claridgicus

Describe the bug
I am running a redissearch instance to curate product information for many merchants
Merchants divvy up their products into user-friendly "categories" which typically contain their own unique sort order.
I have loaded in the merchants' products using prefix keys to partition them from each other
I create a "Category" index, which contains useful information for a customer to interact with, price, tags, title etc and also includes a reference to a nested JSON object "sortOrder"

My index looks a bit like this

'$.title': {
	type: SchemaFieldTypes.TEXT,
	SORTABLE: true,
	AS: 'title',
},

'$.tags': {
	type: SchemaFieldTypes.TAG,
	AS: 'tags',
},

"$['sortOrder']['example1']": {
        type: SchemaFieldTypes.NUMERIC,
        SORTABLE: true, 
        AS: 'example1' 
}  << I might have 2-600 of these for a given store

When an index exceeds 250 sort definitions (which if you ask redis to create an index it will successfully create one without error or warning) querying for the index with an appropriate SortBy will result in out-of-order objects.

To Reproduce
Steps to reproduce the behaviour:

  1. Load in a couple of thousand product objects
  2. Define an arbitrary numeric sort for them in a child property
  3. Create an index that has 250 unique sorts
  4. Query for products, with "SortBy" set to be one of your unique sorts

Expected behaviour
This should still work, albeit slowly - or the index should fail to create in the first instance

I can provide access to a redis instance over DM to someone to debug an actual dataset if required.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions