jayson
January 10, 2022, 8:53am
1
So I just updated to the latest version of ParseSwift 3.1.0 and got this error on my ParseObjects.
I was wondering what the best use case for it and why it was added. I was looking at the commit and didn’t see any explanation for it.
Is it the lower the number, the more priority it has on matchesText()?
thanks,
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:
1 Like
jayson
January 11, 2022, 6:58am
3
I think I got the gist of it. So it’s basically there for when we use matchesQuery.
Thanks again