Created
November 4, 2020 05:14
-
-
Save Ananto30/e701c10b45ab8b54d588cb8bd1a2ea34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db[collection].aggregate( | |
[ | |
{ | |
"$search": { | |
"text": { | |
"query": term, | |
"path": ["body_en", "chapter_en"], | |
"fuzzy": {"maxEdits": 1, "maxExpansions": 10}, | |
}, | |
"highlight": {"path": ["body_en", "chapter_en"]}, | |
} | |
}, | |
{"$limit": 50}, | |
{ | |
"$project": { | |
"_id": 0, | |
"collection_id": 1, | |
"collection": 1, | |
"hadith_no": 1, | |
"book_no": 1, | |
"book_en": 1, | |
"chapter_no": 1, | |
"chapter_en": 1, | |
"narrator_en": 1, | |
"body_en": 1, | |
"book_ref_no": 1, | |
"hadith_grade": 1, | |
"score": {"$meta": "searchScore"}, | |
"highlights": {"$meta": "searchHighlights"}, | |
} | |
}, | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment