On Tue, Aug 7, 2012 at 8:36 PM, Alec Flett <alecfl...@google.com> wrote:
> FWIW it's fairly hard to for a database to index arbitrary content for > regexes, to the point where it's going to be hard to do MUCH better than > simply filtering based on regex. > Perhaps it shouldn't be a full-text *index* but simply a search feature. Though I'm unfamiliar with specific implementations, I gather that filtering records in native code would save (possibly lots of) redundant JS object construction (time and memory = money :)), and doing so with a pre-compiled regex might improve over certain JS implementation or non-optimizable practices, e.g. function search(field, s) { someCallToIndexedDb(function filter(record) { var re = new RegExp(s); return !re.test(record[field]); } } Plus it saves some code jumbling for a rather common practice.