quickwit-oss / quickwit-oss/quickwit

sort_by_field returns incorrect results on text fields

Open
#1,450 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
11.7k
Forks
597
Avg merge
2d 22h
Merged PRs (30d)
37

Description

Sorting doesn't appear to work correctly on text fields. It does change the order of the results and if you do sort_by_field=-name vs sort_by_field=name you will get different results but the results are not in the expected order.

Field mapping:

    - name: name
      type: text
      fast: true

Results

curl -sS 'http://127.0.0.1:7280/api/v1/noaa-1m/search?query=name:NO&sort_by_field=-name&max_hits=100'
{
  "num_hits": 235019,
  "hits": [
    {
      "name": "VAERNES, NO",
      "split_id": 3,
      "station_id": "01271099999",
      "temperature_c": 8.0,
      "wind_direction_deg": 250,
      "wind_speed_code": "N"
    },
    {
      "name": "FLORO, NO",
      "split_id": 3,
      "station_id": "01310099999",
      "temperature_c": 7.0,
      "wind_direction_deg": 190,
      "wind_speed_code": "N"
    },
    {
      "name": "TROLL A OIL PLATFORM, NO",
      "split_id": 3,
      "station_id": "01087799999",
      "temperature_c": 7.0,
      "wind_direction_deg": 210,
      "wind_speed_code": "N"
    },
    {
      "name": "RYGGE, NO",
      "split_id": 3,
      "station_id": "01494099999",
      "temperature_c": 5.0,
      "wind_direction_deg": 200,
      "wind_speed_code": "N"
    },
    {
      "name": "GULLFAX PLATFORM, NO",
      "split_id": 3,
      "station_id": "01375599999",
      "temperature_c": 8.0,
      "wind_direction_deg": 250,
      "wind_speed_code": "N"
    },
    {
      "name": "SOLA, NO",
      "split_id": 3,
      "station_id": "01415099999",
      "temperature_c": 7.0,
      "wind_direction_deg": 230,
      "wind_speed_code": "N"
    },

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the provided field mapping and curl requests against the NOAA dataset, comparing ascending and descending name sorting. Trace the search sorting path for text fields and define done as results appearing in the expected lexical order in both directions, with regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.