askorama / orama

🌌 Fast, dependency-free, full-text and vector search engine with typo tolerance, filters, facets, stemming, and more. Works with any JavaScript runtime, browser, server, service!
https://docs.orama.com
Other
8.53k stars 285 forks source link

Limit/order/offset do not work on string/string [] facets search #743

Open militsa-tsvetkova opened 3 months ago

militsa-tsvetkova commented 3 months ago

Describe the bug

Limit/order/offset do not work on string/string [] facets search

To Reproduce

exemplary schema for data

status: 'string',
applicability: 'string[]',

Expected behavior

Expect results to be sorted when passing order to faceted search but they are not - assume they are sorted by relevance, but not always Exemplary payload

{ "facets": { "applicability": { "order": "DESC" }, "status": { "order": "DESC" } }, "preflight": true }

Exemplary response

{
    "elapsed": {
        "raw": 8976344,
        "formatted": "8ms"
    },
    "hits": [],
    "count": 2551,
    "facets": {
        "applicability": {
            "count": 6,
            "values": {
                "O..": 23,
                "F..": 64,
                "C...": 116,
                "A..": 35,
                "I...": 36,
                "D....": 11
            }
        },
        "status": {
            "count": 4,
            "values": {
                "C....": 2480,
                "F....": 66,
                "E....": 3,
                "": 2
            }
        }
    }
}

Environment Info

Orama: 2.0.20
Node: 18.17.0

Affected areas

Search

Additional context

No response

militsa-tsvetkova commented 2 months ago

A correction to the reported issues - sort does work on String Fields but not on array of strings. Any plans to extend it soon?