-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from biothings/indexer-update
Add MyChemIndexer class
- Loading branch information
Showing
17 changed files
with
862 additions
and
837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,33 @@ | ||
import asyncio | ||
from copy import deepcopy | ||
|
||
from biothings.hub.dataindex.indexer import Indexer | ||
|
||
DEFAULT_INDEX_MAPPINGS = { | ||
"properties": { | ||
"all": {"type": "text"}, | ||
"name": { | ||
"type": "text", | ||
"fields": { | ||
"raw": { | ||
"type": "keyword", | ||
"ignore_above": 128, | ||
"normalizer": "keyword_lowercase_normalizer" | ||
} | ||
}, | ||
"copy_to": "all" | ||
} | ||
} | ||
} | ||
|
||
class DrugIndexer(Indexer): | ||
pass | ||
|
||
# @asyncio.coroutine | ||
# def index(self, job_manager, steps=("pre", "index", "post"), batch_size=2500, ids=None, mode="index"): | ||
# return super().index(job_manager, steps=steps, batch_size=batch_size, ids=ids, mode=mode) | ||
class MyChemIndexer(Indexer): | ||
def __init__(self, build_doc, indexer_env, index_name): | ||
super().__init__(build_doc, indexer_env, index_name) | ||
|
||
new_mappings = deepcopy(DEFAULT_INDEX_MAPPINGS) | ||
|
||
self.es_index_mappings["properties"].update( | ||
new_mappings["properties"]) | ||
|
||
self.logger.debug("Updated Index mappings: %s", | ||
dict(self.es_index_mappings)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.