Dashboard search sorts by updateDate rather than term match rendering it unusable

Closed
Feature
Other
Opened
Assigned to
katerinach
Waiting for ResponseDone

Description

The search bar in https://www.worldanvil.com/p/desktop mode is completely unusable because it is returning results sorted by "updateDate" rather than how closely the result matches the search term. This makes the search totally unusable for finding articles by title if you haven't recently updated them.   It's so frustrating to have 5 different articles with "Captain" in the title and for 0 of them to show up in the dashboard search results.   Conversely, when I click "View World" and use its search bar, the search works perfectly and articles with my search term in the title ALWAYS appear FIRST.

Steps to Reproduce

Here is an imgur post with a video and additional screenshots: https://imgur.com/a/R32c0ds   1. Go to https://www.worldanvil.com/p/desktop 2. Click the Search icon or Ctrl + K 3. Open the browser console and click on the network tab 4. Enter a term that is in an article title that hasn't been updated in a long time (preferably a term that appears across many articles). In my world, I searched "Tournelle" and expected the 4 articles with that term in the title to be at the top of the results list. 5. See that the results are in update order, and (depending on the term) the article with the term in the title is not even visible in the result.  
  6. In the network tab, look for a POST to https://www.worldanvil.com/api/internal/aboleth/world/variables/search 7. Click on the "Request" tab to view the rest body, and see that it contains sortBy: "updateDate".   Here is that POST copied as a fetch for my "Tournelle" search:
await fetch("https://www.worldanvil.com/api/internal/aboleth/world/search?id=db8e5425-5c36-47e4-b003-0f48403821c6", {
  "credentials": "include",
  "headers": {
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:143.0) Gecko/20100101 Firefox/143.0",
    "Accept": "application/json",
    "Accept-Language": "en-US,en;q=0.5",
    "content-type": "application/json",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-origin",
    "Priority": "u=4"
  },
  "referrer": "https://www.worldanvil.com/p/athena/article/5a15b01a-81ca-417d-aa00-0fad3c3cd5ad/edit",
  "body": "{\"term\":\"tournelle\",\"sortDir\":\"DESC\",\"sortBy\":\"updateDate\",\"limit\":20}",
  "method": "POST",
  "mode": "cors"
}
  8. Click "View World" 9. Filter your network URLs for "article" 10. Enter the same search term in the world view search box 11. See that the top results are articles with your search term in the title (aka, what you would expect from the dashboard search)  
  12. In the network tab of your browser developer tools, look for the latest GET request to https://www.worldanvil.com//api/worlds/[your world id]/articles and see that there is no sortBy in either the query params nor the request body.   Here is that GET copied as a fetch for my "Tournelle" search:
await fetch("https://www.worldanvil.com/api/worlds/db8e5425-5c36-47e4-b003-0f48403821c6/articles?term=tournelle&type=advanced", {
  "credentials": "include",
  "headers": {
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:143.0) Gecko/20100101 Firefox/143.0",
    "Accept": "*/*",
    "Accept-Language": "en-US,en;q=0.5",
    "X-Requested-With": "XMLHttpRequest",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-origin"
  },
  "referrer": "https://www.worldanvil.com/w/lies-26-liability-grimmoireproductions",
  "method": "GET",
  "mode": "cors"
}

History

Comments and updates to this report

Dimitris Developer
Assigned katerinach
synchr0nicity Developer

Hello grimmoireproductions, thanks a lot for the detailed report! We had a look and the issue was down to some parametrization being done out of order on the backend. You should now see this issue resolved. Happy WorldBuilding!

synchr0nicity Developer
Added tag Done
synchr0nicity Developer
Added tag Waiting for Response
synchr0nicity Developer
set this bug to closed