mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-26 07:25:44 +00:00
fixed pattern search for meta_data
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
697befbbda
commit
3376912871
@ -262,8 +262,9 @@ def get_txids_filtered(connection, asset_id: str, operation: str = None,
|
||||
@register_query(TarantoolDBConnection)
|
||||
def text_search(conn, search, table='assets', limit=0):
|
||||
pattern = ".{}.".format(search)
|
||||
field_no = 1 if table == 'assets' else 2 # 2 for meta_data
|
||||
res = conn.run(
|
||||
conn.space(table).call('indexed_pattern_search', (table, 1, pattern))
|
||||
conn.space(table).call('indexed_pattern_search', (table, field_no, pattern))
|
||||
)
|
||||
return res[0] if limit == 0 else res[0][:limit]
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ INDEX_COMMANDS = {
|
||||
"meta_data":
|
||||
{
|
||||
"id_search": "meta_datas:create_index('id_search', { type='hash' , parts={'transaction_id'}})",
|
||||
"text_search": "meta_datas:create_index('secondary', {unique=false,parts={2,'string'}}"
|
||||
"text_search": "meta_datas:create_index('secondary', {unique=false,parts={2,'string'}})"
|
||||
},
|
||||
"pre_commits":
|
||||
{
|
||||
|
||||
@ -46,7 +46,6 @@ class MetadataApi(Resource):
|
||||
metadata = planet.text_search(**args)
|
||||
|
||||
try:
|
||||
# This only works with MongoDB as the backend
|
||||
return list(metadata)
|
||||
except OperationError as e:
|
||||
return make_error(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user