Now allowing JSON indexes on stores containing mixed type items.
h3rald h3rald@h3rald.com
Thu, 04 Jun 2020 09:18:26 +0200
2 files changed,
1 insertions(+),
6 deletions(-)
M
src/admin/md/api_indexes.md
→
src/admin/md/api_indexes.md
@@ -7,11 +7,6 @@ > This resource has been introduced in version 5 of the LiteStore API.
LiteStore Indexes are special indexes used to optimize the performance of queries on JSON documents. -> %warning% -> JSON-only Documents Required! -> -> Indexes can be created *only* if the entire database is composed by JSON documents. If not, LiteStore will return an error when attempting to create the first index. - #### OPTIONS indexes Returns the allowed HTTP verbs for this resource.
M
src/litestorepkg/lib/core.nim
→
src/litestorepkg/lib/core.nim
@@ -136,7 +136,7 @@
# Manage Indexes proc createIndex*(store: Datastore, indexId, field: string) = - let query = sql("CREATE INDEX json_index_$1 ON documents(json_extract(data, ?) COLLATE NOCASE)" % [indexId]) + let query = sql("CREATE INDEX json_index_$1 ON documents(json_extract(data, ?) COLLATE NOCASE) WHERE json_valid(data)" % [indexId]) store.begin() store.db.exec(query, field) store.commit()