FAQ
Hi Mario,

No that's not correct, you can use `extractKeywords` with multiple
words (I should update the example) -- it is the same method that is
used internally to construct the keywords. The $in operator lets you
match arrays against arrays and you might also want to look at $all if
you want to match every keyword (or use both and put the $all results
on top) but that part of the implementation is up to you.

Calling `extractKeywords` will also apply stemming to `text` before
using it to search if you use that option.

http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24in


Thomas Blobaum
https://github.com/tblobaum

On Tue, May 15, 2012 at 5:00 AM, Mario wrote:
Thank you for the reply, Do I understand correct that I can find documents
by using only a single keyword like this?

fooModel.find({
keywords: { $in: fooModel.extractKeywords('text') }
}, function(docs) {
// ...
})

But not like this:

fooModel.find({
keywords: { $in: fooModel.extractKeywords('text full') }
}, function(docs) {
// ...
})

On Tuesday, May 15, 2012 12:43:48 PM UTC+4, Thomas wrote:

Hi Mario,

I wrote a module/plugin for mongoose that helps with this, available
here https://github.com/tblobaum/mongoose-troop#keywords

Optionally you can use it to apply porter-stemming to words in your
`name` field so that a search for `full texts` also returns documents
that have `full text`, etc

http://www.mongodb.org/display/DOCS/Full+Text+Search+in+Mongo
http://en.wikipedia.org/wiki/Stemming

Hope that helps.

Thomas Blobaum
https://github.com/tblobaum

On Tue, May 15, 2012 at 2:10 AM, Mario <> wrote:
I have the documents like this:

{
_id: ObjectId(),
name: 'Text'
},
{
_id: ObjectId(),
name: 'the text'
},
{
_id: ObjectId(),
name: 'the full text'
}

How can I find all documents matching the following text 'text full'?
Should
I use regexp?

--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoose-orm@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en
--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoose-orm@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en
--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoose-orm@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 12 | next ›
Discussion Overview
groupmongoose-orm @
categoriesmongodb, nodejs
postedMay 15, '12 at 7:10a
activeNov 15, '13 at 2:13a
posts12
users5
websitemongoosejs.com
irc#mongoosejs

People

Translate

site design / logo © 2022 Grokbase