W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: [IndexedDB] Full text search?

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 9 Apr 2012 12:52:50 -0700
Message-ID: <CA+c2ei--mpCmfXsBSvuKwdabDcB4-pMZDoGv21zOWc6seb64Vw@mail.gmail.com>
To: Javier Holguera Blanco <jholguerablanco@hotmail.com>
Cc: art.barstow@nokia.com, public-webapps@w3.org
On Sun, Apr 8, 2012 at 11:23 AM, Javier Holguera Blanco
<jholguerablanco@hotmail.com> wrote:
>
>  Hi,
>
> Thanks for your answer.
>
> So, if I have understood you, in this versión we cannot expect any update on
> this issue. The only possible search will be a "perfect match" search for a
> concrete field. No "Start With" even, right?

You can do "start with" searches by using simple key-ranges. I.e. to
iterate all the records of an object store which have keys starting
with "hello" you simply do:

range = IDBKeyRange.bound("hello", "hello\uffff");
myObjectStore.openCursor(range);

Since we don't have a query language in IndexedDB, we also don't have
things like "search", or "sort" features. You can easily do basic
searches and sorting by traversing object stores and indexes, and if
you want to do more advanced searches and sorting you can implement
that on top of the primitives that IndexedDB provides. So you can
implement your own full text search by using object stores in clever
ways. This is how all databases work under the hood.

Building query functionality on top of IndexedDB is certainly not an
easy task though. Hopefully we will see libraries that do so very soon
(I've already seen one, though no public ones yet). Possibly we will
also add some of this functionality in future versions of IndexedDB.

/ Jonas
Received on Monday, 9 April 2012 19:53:51 GMT

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