Skip to content

Commit

Permalink
add indexer module comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry committed Aug 17, 2021
1 parent cc3b507 commit d847fcf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion biothings/hub/dataindex/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,17 @@ def parse_backend(self):
backend = self.get("target_backend")
backend_url = self.get("backend_url")

# Case 1:
# As a dummy indexer
# Used in validate_mapping, ...

if backend is None:
return _BuildBackend()

# Case 2:
# Most common setup
# Index a merged collection

elif backend == "mongo":
from biothings.hub.databuild import backend

Expand All @@ -148,6 +156,10 @@ def parse_backend(self):
db.client.address
)), db.name, backend_url)

# Case 3:
# For single source build_config(s)
# Index the source collection directly

elif backend == "link":
from biothings.hub.databuild import backend

Expand Down Expand Up @@ -662,7 +674,7 @@ def _select_indexer(self, target_name=None):

def index(self,
indexer_env, # elasticsearch env
target_name, # source mongodb collection
target_name, # build name
index_name=None, # elasticsearch index name
ids=None, # document ids
**kwargs):
Expand Down

0 comments on commit d847fcf

Please sign in to comment.