Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #36 from postatum/93537988_index_script
Browse files Browse the repository at this point in the history
Allow passing model names and paths to es.py
  • Loading branch information
jstoiko committed May 14, 2015
2 parents fe5a0c3 + 23701f9 commit 7f38970
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nefertari/scripts/es.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from zope.dottedname.resolve import resolve

from nefertari.utils import dictset, split_strip, to_dicts
from nefertari import engine


def main(argv=sys.argv, quiet=False):
Expand Down Expand Up @@ -38,7 +39,8 @@ def __init__(self, argv, log):
'--quiet', help='Quiet mode', action='store_true',
default=False)
parser.add_argument(
'--models', help='List of dotted paths of models to index',
'--models',
help='Comma-separeted list of model names to index',
required=True)
parser.add_argument(
'--params', help='Url-encoded params for each model')
Expand Down Expand Up @@ -71,11 +73,10 @@ def __init__(self, argv, log):
def run(self, quiet=False):
from nefertari.elasticsearch import ES
ES.setup(self.settings)
models_paths = split_strip(self.options.models)
model_names = split_strip(self.options.models)

for path in models_paths:
model = resolve(path)
model_name = path.split('.')[-1]
for model_name in model_names:
model = engine.get_document_cls(model_name)

params = self.options.params or ''
params = dict([
Expand Down

0 comments on commit 7f38970

Please sign in to comment.