Parse-server: Full-text search ascending/descending bug (typo?)

Created on 14 Apr 2019  路  6Comments  路  Source: parse-community/parse-server

I have just discovered that when I want to use a full-text search with ordering, only query.ascending('$score') is working. query.descending('$score') throws "Invalid field name: $score.".

When you are doing a full-text search, you obviously want the results with a higher score first, so it should be descending. But here's the thing - it actually returns the results in descending order.

It seems to be only a wording bug, but fixing it might be tricky because developers who are already using the query.ascending('$score') for getting the descending results will not expect the change in future version.

Maybe the safest 'fix' would be to add a warning note to the docs that this wording mistake has been made and ignore it. Nobody will probably ever need (actually) ascending results anyway 馃槃

Tested on 2.8.4, 3.1.3, 3.2.3 in cloud code function

bug documentation

Most helpful comment

@acinader - is this open ? Hunting good-first issues

All 6 comments

Nice catch! I use it but never really thought about it, it is descending

@rihadavid any interest in taking this on?

Steps I'd think we'd need:

  1. failing test to verify
  2. add deprecation notice to code and documentation

Ideally, we could find some 'new way' to do it right query.ascendingScore()/query.descendingScore()
is the terrible first thing that comes to mind, so we don't have to deal with any blast radius by actually breaking it.

In the future, we could then decide to no longer support '$score' passed in...

@acinader thanks for the suggestions, unfortunately, reporting bugs is the best I can do at the moment, working 12 hours a day on my startup 馃檲

@acinader - is this open ? Hunting good-first issues

@iamvajid this one is still open. A PR will be very welcomed.

Thanks @davimacedo , i will give it a try

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kilabyte picture kilabyte  路  4Comments

ViolentCrumble picture ViolentCrumble  路  3Comments

omyen picture omyen  路  3Comments

dcdspace picture dcdspace  路  3Comments

mohmagdy picture mohmagdy  路  3Comments