-
-
Notifications
You must be signed in to change notification settings - Fork 735
Support for Full Text Search #772
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #772 +/- ##
============================================
+ Coverage 53.38% 53.41% +0.03%
- Complexity 1746 1747 +1
============================================
Files 132 132
Lines 10286 10293 +7
Branches 1427 1427
============================================
+ Hits 5491 5498 +7
Misses 4340 4340
Partials 455 455
Continue to review full report at Codecov.
|
@rogerhu Can you look this over? |
Thanks for adding! |
FYI - I think the docs need to be improved. Kept getting curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-Master-Key: ${MASTER_KEY}" \
-H "Content-Type: application/json" \
-d '
{
"className": "GameScore",
"fields": {
"playerName": {
"type": "String"
}
},
"indexes": {
"indexName": {
"playerName": 1
}
}
}' \
http://localhost:1337/parse/schemas/GameScore This fixed the problem:
|
@rogerhu what version of Parse-server are you running. Text indexes should be automatically created. |
The Schema API creates an index, but not a text index:
Only by calling the Mongo specific index does it work:
|
I was also using the latest commit 8ec07b83d0b74b00153b7b414aa73d7247c55f85 of Parse-Server |
Dropping the table and SCHEMA info and re-creating the table doesn't help either:
POST to create some data: curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-Master-Key: ${MASTER_KEY}" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
http://localhost:1337/parse/schemas/GameScore Mongo: > db.getCollection("_SCHEMA").find({"_id": "GameScore"})
{ "_id" : "GameScore", "objectId" : "string", "updatedAt" : "date", "createdAt" : "date" }
> db.GameScore.getIndexes()
[ ] |
I put a breakpoint but don't ever see createTextIndexesIfNeeded() get called either |
For the schema you could do
Thats interesting if createTextIndexesIfNeeded() isn't called. I'll look into it, I was going to improve the indexing after the next parse-server update |
It seems like I have to explicitly use the "text" field instead of 1 (#772 (comment)): curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-Master-Key: ${MASTER_KEY}" \
-H "Content-Type: application/json" \
-d '
{
"className": "GameScore",
"fields": {
"playerName": {
"type": "String"
}
},
"indexes": {
"indexName": {
"playerName": "text"
}
}
}' \
http://localhost:1337/parse/schemas/GameScore Then it seems to work: > use parse
switched to db parse
> db.GameScore.getIndexes()
[
{
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "parse.GameScore"
},
{
"v" : 2,
"key" : {
"_fts" : "text",
"_ftsx" : 1
},
"name" : "indexName",
"ns" : "parse.GameScore",
"weights" : {
"playerName" : 1
},
"default_language" : "english",
"language_override" : "language",
"textIndexVersion" : 3
}
] Again, it seems like the documentation needs to reflect this aspect. It seems like text indexes get added if you only add new fields to an existing class right? |
Yep @dplewis that worked. |
@rogerhu I can update the docs. When |
Yeah I revised my comment. Create text indexes never gets fired. It seems like it passes in directly the create index command from the dictionary. |
|
That error is coming back from Mongo, not Parse server I believe. |
Ah, I see |
Closes: #751
I did run into issues with 27 API Licensing but resolved it.