mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 22:45:44 +00:00
added limit to text_Search
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
e5c6282490
commit
772b28eabc
@ -260,12 +260,10 @@ def get_txids_filtered(connection, asset_id: str, operation: str = None,
|
|||||||
@register_query(TarantoolDBConnection)
|
@register_query(TarantoolDBConnection)
|
||||||
def text_search(conn, search, table='assets', limit=0):
|
def text_search(conn, search, table='assets', limit=0):
|
||||||
pattern = ".{}.".format(search)
|
pattern = ".{}.".format(search)
|
||||||
print("TEXT SEARCH FOR: {}".format(search))
|
|
||||||
res = conn.run(
|
res = conn.run(
|
||||||
conn.space(table).call('indexed_pattern_search', (table, 1, pattern))
|
conn.space(table).call('indexed_pattern_search', (table, 1, pattern))
|
||||||
)
|
)
|
||||||
print("TEXT SEARCH RES: {}".format(res))
|
return res[0] if limit == 0 else res[0][:limit]
|
||||||
return res
|
|
||||||
|
|
||||||
def _remove_text_score(asset):
|
def _remove_text_score(asset):
|
||||||
asset.pop('score', None)
|
asset.pop('score', None)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user