You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to filter on 1676 product-types using whoosh, tinydb, or built-in python list comprehension using free text search:
# whoosh: elapsed time 0.010sdag.guess_product_type("(Sentinel OR Landsat) AND OPTICAL")
# tinydb: elapsed time 0.013s
[
pt["ID"] forptindb.search(
lambdarecord: (
any("Sentinel"instr(value) forvalueinrecord.values()) orany("Landsat"instr(value) forvalueinrecord.values())
) andany("OPTICAL"instr(value) forvalueinrecord.values())
)
]
# built-in python: elapsed time 0.013s
[
kfork, vindag.product_types_config.items()
if (
any("Sentinel"instr(x) forxinv.values()) orany("Landsat"instr(x) forxinv.values())
) andany("OPTICAL"instr(x) forxinv.values())
]
Built-in python list comprehension performance is equivalent to whoosh and tinydb. It avoids dependencies and whoosh build index.
But it needs to efficiently translate free-text-search to appropriate python filtering.
Whoosh is not actively maintained and sometimes causes errors when several processes try to write in index at the same time.
It may be a good option to directly work on the product-types configuration dictionary, or try another library.
Check how TinyDB could replace
whoosh
ineodag
. Usage example:The text was updated successfully, but these errors were encountered: