Browse Source

support search w/o options and make it faster..

main
John-Mark Gurney 3 months ago
parent
commit
5be7637f0d
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      ui/medashare/cli.py

+ 25
- 0
ui/medashare/cli.py View File

@@ -1594,6 +1594,31 @@ def cmd_search(options, persona, objstr, cache):
searches = [ (x[0], ) + tuple(x[1:].split('=', 1)) for x in args ]
#_debprint(repr(searches))

if not searches:
# just dump everything
mdofile = aliased(orm.MetaDataObject)

sel = select(mdofile.data).where(
# we are operating on files
mdofile.type == 'file')

sel = sel.execution_options(yield_per=10)

with objstr._ses() as session:
r = ( x[0] for x in session.execute(sel) )

if _type == 'file':
mapping = FileObject.prep_mapping(
objstr.get_hostmappings())
r = ( x.get_lcl_name(mapping) for x in r )
else:
raise ValueError('unhandled type: %s' % repr(_type))

for i in r:
print(i)

return

propmap = aliased(orm.PropertyMapping)

# propobj only returns what can match query


Loading…
Cancel
Save