Created
January 24, 2022 02:20
-
-
Save phpsmarter/8e0ad1879ba2925a93968d297176f7f1 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
var pouch = new PouchDB('mydb'); | |
var doc = {_id : 'mydoc', title : "Guess who?", text : "It's-a me, Mario!"}; | |
pouch.put(doc).then(function() { | |
return pouch.search({ | |
query : 'mario', | |
fields : [ 'title', 'text' ], | |
include_docs : true, | |
highlighting : true | |
}); | |
}) | |
.then(function(res) { | |
console.log(res.rows[0].doc.text); // "It's-a me, Mario!" | |
console.log(res.rows[0].highlighting); // {"text": "It's-a me, <strong>Mario</strong>!"} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment