Note that there are some explanatory texts on larger screens.

plurals
  1. POCase-insensitive searching in indexedDB
    text
    copied!<p>Can someone please tell me if it is possible to execute case-insensitive search on indexeddb object store using index, openCursor and keyRange....<br> I can do case sensitive and managed to implement something using toUpperCase function but there are so many different varaitions that it is not feasible relly...<br> Any help welcomed... Thanx... Example of an attempt:</p> <pre><code>var transaction = db.transaction("products", IDBTransaction.READ_ONLY); var store = transaction.objectStore("products"); var descIndex = store.index('Index1'); var boundKeyRangeUpper = IDBKeyRange.bound(request.term.toUpperCase(), (request.term.toUpperCase()+'Z')); descIndex.openCursor(boundKeyRangeUpper).onsuccess = function (e) </code></pre> <p><strong>UPDATE</strong><br> This is what I ended up implementing: Four ranges that cover and possibility i.e. FA,fA,Fa,fa... This is done on the first letter only i.e. 'F' </p> <p><code>var boundKeyRangeUpper = IDBKeyRange.bound(term.toUpperCase(), term.toUpperCase()+'Z'); var boundKeyRangeUpper2 = IDBKeyRange.bound(term.toUpperCase(), term.toUpperCase()+'z'); var boundKeyRangeLower = IDBKeyRange.bound(term.toLowerCase(), term.toLowerCase()+'z'); var boundKeyRangeLower2 = IDBKeyRange.bound(term.toLowerCase(), term.toLowerCase()+'Z');</code></p> <p>The results of the searches above is stored in another objectStore but with their description as uppercase hence FISH, FRUIT, FRESH SALAD... Now if a letter is pressed after F e.g. 'r' the search will look into this new object store where everything is uppercase... This is not an ideal solution by far but it works and it is quick for my needs... Perhaps we will get case insensative search eventually, perhaps not...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload