Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search results from API change when fields param is used #10088

Closed
gineer01 opened this issue Mar 8, 2024 · 1 comment
Closed

Search results from API change when fields param is used #10088

gineer01 opened this issue Mar 8, 2024 · 1 comment
Assignees
Labels
api Joplin API bug It's a bug high High priority issues

Comments

@gineer01
Copy link

gineer01 commented Mar 8, 2024

Operating system

macOS

Joplin version

Joplin 2.14.17 (prod, darwin)

Desktop version info

Joplin 2.14.17 (prod, darwin)

Client ID: 41fd86eba6dd407a94d2655b86ad878a
Sync Version: 3
Profile Version: 46
Keychain Supported: Yes

Revision: 094175c

Backup: 1.4.0
Joplin DDDot: 0.3.1
macOS theme: 1.3.18
Quick Links: 1.3.1

Current behaviour

I'm using Joplin API and notice the search results change when I add fields param. For example: without fields, the results are highly relevant (the keyword "quantum" is in the title). Adding fields param, it returns irrelevant results (but the keyword is in the body, so it's not wrong). I suspect it's no longer sorted by relevance and limit=2 returns first 2 results from some random order.

~/.config/joplin-desktop$ curl 'http:https://localhost:41184/search?query=quantum&token=TOKEN&limit=2' | jq .
{
  "items": [
    {
      "id": "f04fd184bc4a4ad1a823054b83ebbd0f",
      "parent_id": "3310ebbbd85b4c6394fd4dc8ab1ab47e",
      "title": "Quantum entanglement"
    },
    {
      "id": "65b5e23c05a64941b17399780f4ed8df",
      "parent_id": "3310ebbbd85b4c6394fd4dc8ab1ab47e",
      "title": "CRYPTOGRAPHY IN THE QUANTUM AGE"
    }
  ],
  "has_more": true
}


~/.config/joplin-desktop$ curl 'http:https://localhost:41184/search?query=quantum&token=TOKEN&limit=2&fields=id%2Ccreated_time%2Ctitle%2Cupdated_time%2Ctodo_due' | jq .
{
  "items": [
    {
      "id": "64ddf6ce7bec41ab8a98120ef0295ba1",
      "created_time": 1302028192000,
      "title": "India Graduates Millions, but Too Few Are Fit to Hire - WSJ.com",
      "updated_time": 1302028192000,
      "todo_due": 0
    },
    {
      "id": "bb2895ed7cca439ebdbf302ea35cc0fc",
      "created_time": 1298171990000,
      "title": "UCB CS61A",
      "updated_time": 1305927441000,
      "todo_due": 0
    }
  ],
  "has_more": true
}

Expected behaviour

The search results should not change because fields param is used.

Logs

No response

@gineer01 gineer01 added the bug It's a bug label Mar 8, 2024
@personalizedrefrigerator personalizedrefrigerator added api Joplin API high High priority issues labels Mar 8, 2024
@gineer01
Copy link
Author

More details on the bug: I've found this only happens if updated_time is included and the result is sorted by updated_time. If updated_time is not included, the result doesn't change.

@laurent22 laurent22 self-assigned this Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Joplin API bug It's a bug high High priority issues
Projects
None yet
Development

No branches or pull requests

3 participants