W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

Re: IndexedDB and RegEx search

From: Yuval Sadan <sadan.yuval@gmail.com>
Date: Wed, 8 Aug 2012 11:33:38 +0300
Message-ID: <CAJaqjSr63w_j+Sz0xx5+rAXwbANaaosuYOdr+VuSNzwKth-UdQ@mail.gmail.com>
To: Alec Flett <alecflett@google.com>
Cc: Michael Brooks <firealwaysworks@gmail.com>, public-webapps@w3.org
On Tue, Aug 7, 2012 at 8:36 PM, Alec Flett <alecflett@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.
Received on Wednesday, 8 August 2012 08:34:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:54 GMT