Pouchdb Collate - Help Needed

84 views
Skip to first unread message

Josh

unread,
Aug 15, 2015, 1:20:42 PM8/15/15
to PouchDB
Hi, 

I am newbie for pouchdb. With some of the use case i got stuck in further proceeding.  If any of the help is appreciated.  Here is my use case


 User response will be in JSON format like { title : string, sub : string, content : string}   
 If user search for something, first it will look on the local database & later it will send query to server 
 For this, that search text may be in title or sub or content.  To filter out those results we can use pouchdb query (map function). But i am trying to find a way to achieve this using primary index _id itself. 
 In pouchdb page, i got to know about pouchdb collate which will combine array of keys into single form and later we can use it as primary key.  So i decided to collate 2 fields title & sub and made it as _id.  
 Here after only i am facing the issue, i don't know how to filter out some of the docs  if sub contains <some string>
 I have created a sample gist for the same  -  http://bl.ocks.org/joshongit/a0a232fab9a83ce5ef7b   Click on "generate doc" will generate 10 random string docs & will print the doc details. And you can paste some string in text box & click filter will look for search string ( this is my use case)
   
PS : Also pouchdb collate is creating some random number - that is also i don't know why its meant for.

Thanks,
Josh

Nolan Lawson

unread,
Aug 17, 2015, 10:27:23 AM8/17/15
to PouchDB
Hi Josh,

If you are looking for text INSIDE of a string, e.g. the string is "the quick brown fox jumps over the lazy dog" and you want to find by "fox" (or "foxes"), then you want pouchdb-quick-search instead of pouchdb-collate: https://github.com/nolanlawson/pouchdb-quick-search

Cheers,
Nolan

Paweł Psztyć

unread,
Jul 4, 2018, 3:33:19 AM7/4/18
to PouchDB
Nolan,
I am trying to do similar thing. I have an object that contains "name", "description" which right now makes me throw all my hair from my head.
I created an index for both fields but when I am looking for a word that exists somewhere in the description. However it seems not to get it.
I read the docs but I can't find a description of how to do this. Any tips? :)

Thanks
Pawel

Giovanni P

unread,
Jul 4, 2018, 7:18:42 AM7/4/18
to pou...@googlegroups.com
Are you using pouchdb-quick-search?
> --
> You received this message because you are subscribed to the Google Groups "PouchDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pouchdb+u...@googlegroups.com.
> To post to this group, send email to pou...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pouchdb/7f97bca5-6013-448b-aca0-0ce08abd5aa4%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Reply all
Reply to author
Forward
0 new messages