This seems like a common enough scenario that their is probably already a
module for it, so I'm asking before I start writing one :).

Given a generic free form text search input on a webpage I would like to
have it converted over to a query to be executed against my data.  My
target is MongoDB like query instructions, but doesn't have to be MongoDB
as could easily transform it again.

Something like:

foo and bar

might result in something like:

{
  $or: [
    {name: /foo and bar/i},
    {description: /foo and bar/i},
    {$and: [
      {name: /foo/i},
      {name: /bar/i},
    ]},
    {$and: [
      {description: /foo/i},
      {description: /bar/i},
    ]},
    ...etc...
  ]
}

Has anyone already done something similar that is out there and easy to
include, or is this something that still needs to be created?

Thanks,
 - Jeremy

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAAhs7Eh8oPoDs6YH_X0xVjRXnnkMkB%3D5bW_2%2Bh3U1gSUXNctCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to