Re: [IndexedDB] Full text search?

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 UTC