diff --git a/example/osc-blog.py b/example/osc-blog.py index b778a4e..c7fc499 100644 --- a/example/osc-blog.py +++ b/example/osc-blog.py @@ -25,11 +25,11 @@ "engine_name":"elasticsearch" } - #skipchunk_config = skipchunk_config_elastic - skipchunk_config = skipchunk_config_solr + skipchunk_config = skipchunk_config_elastic + #skipchunk_config = skipchunk_config_solr - #source = "blog-posts.json" - source = "blog-posts-one.json" + source = "blog-posts.json" + #source = "blog-posts-one.json" print(timestamp()," | Initializing") diff --git a/setup.py b/setup.py index b694882..b79df24 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,6 @@ test_suite='tests', tests_require=test_requirements, url='https://github.com/o19s/skipchunk', - version='0.9.9', + version='0.9.10', zip_safe=False, ) \ No newline at end of file diff --git a/skipchunk/elastic.py b/skipchunk/elastic.py index eb66ae2..9399bf2 100644 --- a/skipchunk/elastic.py +++ b/skipchunk/elastic.py @@ -86,7 +86,7 @@ def indexes(self) -> list: if r.status_code == 200: #Say cheese indexes = r.json() - indexes = [i["index"].replace('-' + self.kind,'') for i in indexes if '-'+self.kind in i["index"]] + indexes = [i["index"].replace(self.postfix,'') for i in indexes if self.postfix in i["index"]] else: print('ELASTIC ERROR! Cores could not be listed! Have a nice day.') @@ -499,11 +499,12 @@ def explore(self,term,contenttype="concept",build=False,quiet=False,branches=10) # Pretty-prints a graph walk of all suggested concepts and their verbs given a starting term prefix return [] - def __init__(self,host,name,kind,path,enrich_query=None): + def __init__(self,host,name,kind,path,postfix,enrich_query=None): self.host = host - self.name = name + '-' + kind + self.name = name + postfix self.kind = kind self.path = os.path.abspath(path) + self.postfix = postfix self.root = os.path.join(self.path, name) self.elastic_home = os.path.join(self.root, 'elastic_'+self.kind) diff --git a/skipchunk/graphquery.py b/skipchunk/graphquery.py index 736dfc8..6d9a93a 100644 --- a/skipchunk/graphquery.py +++ b/skipchunk/graphquery.py @@ -171,17 +171,18 @@ def __init__(self,config): self.host = config["host"] self.name = config["name"] self.path = config["path"] + self.postfix = "-graph" self.engine_name = config["engine_name"].lower() #Setup the search engine if self.engine_name in ["solr"]: self.engine_name = "solr" - self.engine = solr.Solr(self.host,self.name,self.kind,self.path) + self.engine = solr.Solr(self.host,self.name,self.kind,self.path,self.postfix) elif self.engine_name in ["elasticsearch","elastic","es"]: self.engine_name = "elastic" - self.engine = elastic.Elastic(self.host,self.name,self.kind,self.path) + self.engine = elastic.Elastic(self.host,self.name,self.kind,self.path,self.postfix) else: diff --git a/skipchunk/indexquery.py b/skipchunk/indexquery.py index 6dfc7dc..ea15c34 100644 --- a/skipchunk/indexquery.py +++ b/skipchunk/indexquery.py @@ -50,8 +50,10 @@ def __init__(self,config,enrich_query=None): self.kind = "index" self.host = config["host"] self.name = config["name"] - self.engine_name = config["engine_name"].lower() self.path = config["path"] + self.postfix = "" + + self.engine_name = config["engine_name"].lower() if enrich_query: self.enrich_query = enrich_query.enrich @@ -61,11 +63,11 @@ def __init__(self,config,enrich_query=None): #Setup the search engine if self.engine_name in ["solr"]: self.engine_name = "solr" - self.engine = solr.Solr(self.host,self.name,self.kind,self.path,self.enrich_query) + self.engine = solr.Solr(self.host,self.name,self.kind,self.path,self.postfix,enrich_query=self.enrich_query) elif self.engine_name in ["elasticsearch","elastic","es"]: self.engine_name = "elastic" - self.engine = elastic.Elastic(self.host,self.name,self.kind,self.path,self.enrich_query) + self.engine = elastic.Elastic(self.host,self.name,self.kind,self.path,self.postfix,enrich_query=self.enrich_query) else: raise ValueError("Sorry! Only Solr or Elastic are currently supported") diff --git a/skipchunk/solr.py b/skipchunk/solr.py index 392dca7..4a811ab 100644 --- a/skipchunk/solr.py +++ b/skipchunk/solr.py @@ -100,7 +100,7 @@ def indexes(self,kind=None) -> list: if r.status_code == 200: #Say cheese cores = list(r.json()['status'].keys()) - cores = [c.replace('-' + self.kind,'') for c in cores if self.kind in c] + cores = [c.replace(self.postfix,'') for c in cores if self.postfix in c] else: print('SOLR ERROR! Cores could not be listed! Have a nice day.') @@ -419,11 +419,12 @@ def explore(self,term,contenttype="concept",build=False,quiet=False,branches=10) return tree - def __init__(self,host,name,kind,path,enrich_query=None): + def __init__(self,host,name,kind,path,postfix,enrich_query=None): self.host = host - self.name = name + '-' + kind + self.name = name + postfix self.kind = kind self.path = os.path.abspath(path) + self.postfix = postfix self.solr_uri = self.host + self.name self.root = os.path.join(self.path, name)