(Quick Reference)

Purpose

Executes a MongoDB $text search query

Examples

assert Product.search("coffee").size() == 5
assert Product.search("bake coffee cake").size() == 10
assert Product.search("bake coffee -cake").size() == 6
assert Product.search('"Coffee Cake"').size() == 1

assert Product.search('tarta', [language:'es', offset:5, max:10])

Description

The search method uses MongoDB’s full text search support to perform full text search on a "text" index.