The screenshot you posted shows the comment for score which shows up in the documentation . The PR that made the score
addition links to the Parse Server issue/PR that added score
on the server side
opened 09:52AM - 24 Apr 17 UTC
closed 05:31AM - 03 Nov 17 UTC
Hi, I wanted to know if parse-server support **full text search**. The full text… search is available since MongoDB version 2.6 and it is possible to create text index (currently only one) which provides efficient search capabilities on text fields.
From the code it looks like that this capability has not been implemented ...
In case we need to add this capability i think we should perform the following tasks:
1. Write the server side code (probably modify the MongoDB storage adapter)
2. Update Parse rest api endpoints
3. Update all client SDK's (at least iOS/Android/Javascript)
Thanks.
If you look at matchesText in the documentation it states:
In order to sort you must use Query.sortByTextScore()
. To retrieve the weight/rank, access the “score” property of your ParseObject
.
The explanation for why it was added to a ParseObject as a key and why it’s a breaking change is in the ParseObject documentation :
The Playgrounds shows how to use it:
//: Here's an example of querying using matchesText.
do {
let query6 = try Book.query(matchesText(key: "title",
text: "like",
options: [:]))
.include(["*"])
.sortByTextScore()
query6.find { results in
switch results {
case .success(let books):
print("Found books and included all: \(books)")
case .failure(let error):
assertionFailure("Error querying: \(error)")
}
}
} catch {
print("\(error)")
}
If you have trouble fixing your error, directions are in the release: