index、openCursor、keyRangeを使用してindexeddbオブジェクトストアで大文字と小文字を区別しない検索を実行できるかどうか教えてください。大文字と小文字を区別して、
toUpperCase関数を使用して何かを実装できますが、さまざまなバリエーションがあります。それは実行可能ではありませんrelly...
どんな助けも歓迎します...ありがとう...試みの例:
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)
更新
これは私が実装することになったものです:カバーする4つの範囲、すなわちFA、fA、Fa、fa ...これは最初の文字、すなわち「F」でのみ行われます
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');
上記の検索結果は別のobjectStoreに保存されますが、説明は大文字であるため、FISH、FRUIT、FRESH SALAD ... F eg'r'の後に文字を押すと、検索はこの新しいオブジェクトストアを調べます。大文字です...これは理想的な解決策ではありませんが、機能し、私のニーズに迅速に対応します...おそらく、最終的には大文字と小文字を区別しない検索を取得しますが、そうではないかもしれません...