diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-10-19 19:13:59 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-10-19 19:13:59 -0700 |
commit | bc641c8d9f52867ed7b25015fd7c359fff32582a (patch) | |
tree | f98a32b0b66e4cd86cb222aa9fd735a80c75871d | |
parent | f798d4b050ed9831eacf48ceb586d7925ea2891e (diff) | |
download | fatcat-scholar-bc641c8d9f52867ed7b25015fd7c359fff32582a.tar.gz fatcat-scholar-bc641c8d9f52867ed7b25015fd7c359fff32582a.zip |
issue-db: use dynaconf settings
-rw-r--r-- | fatcat_scholar/issue_db.py | 7 | ||||
-rw-r--r-- | settings.toml | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/fatcat_scholar/issue_db.py b/fatcat_scholar/issue_db.py index ba88d07..e50ae9f 100644 --- a/fatcat_scholar/issue_db.py +++ b/fatcat_scholar/issue_db.py @@ -8,6 +8,8 @@ import fatcat_openapi_client import elasticsearch from elasticsearch_dsl import Search +from fatcat_scholar.config import settings + @dataclass class SimPubRow: @@ -122,6 +124,7 @@ def es_issue_count( .filter("term", issue=issue) .extra(request_cache=True) ) + search = search.params(request_cache='true') return search.count() @@ -378,7 +381,7 @@ def main() -> None: parser.add_argument( "--db-file", help="sqlite3 database file to open", - default="data/issue_db.sqlite", + default=settings.SCHOLAR_ISSUEDB_PATH, type=str, ) @@ -421,7 +424,7 @@ def main() -> None: idb = IssueDB(args.db_file) api = fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient()) - es_client = elasticsearch.Elasticsearch("https://search.fatcat.wiki") + es_client = elasticsearch.Elasticsearch(settings.FATCAT_ELASTICSEARCH_BACKEND) if args.func == "load_pubs": idb.load_pubs(args.json_file, api) diff --git a/settings.toml b/settings.toml index 093acc4..f5078e5 100644 --- a/settings.toml +++ b/settings.toml @@ -4,6 +4,7 @@ SCHOLAR_ENV = "default" SCHOLAR_DOMAIN = "fatcat.wiki" SCHOLAR_ISSUEDB_PATH = "data/issue_db.sqlite" I18N_LANG_DEFAULT = "en" +FATCAT_ELASTICSEARCH_BACKEND = "https://search.fatcat.wiki" ELASTICSEARCH_BACKEND = "https://search.fatcat.wiki" ELASTICSEARCH_FULLTEXT_INDEX = "scholar_fulltext" THUMBNAIL_URL_PREFIX = "https://blobs.fatcat.wiki/thumbnail/pdf/" |