Skip to content

Commit

Permalink
refactor(search): change SEARCH_ADMIN to SEARCH_URL which more clearl…
Browse files Browse the repository at this point in the history
…y defines what the variable is
  • Loading branch information
nsantacruz committed Nov 28, 2023
1 parent d41f35e commit 8a99c92
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build/ci/integration-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ localSettings:
DEBUG: true
DOMAIN_LANGUAGE: {}
APSCHEDULER_NAME: "apscheduler-{{ .Values.deployEnv }}"
SEARCH_ADMIN: "http://elasticsearch-data:9200"
SEARCH_URL: "http://elasticsearch-data:9200"
TURN_SERVER: ''
USE_CLOUDFLARE: false
FRONT_END_URL: "http://${NAME}.integration.sefaria.org"
Expand Down
2 changes: 1 addition & 1 deletion build/ci/production-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ localSettings:
}
MONGO_HOST: "mongo"
APSCHEDULER_NAME: "apscheduler-{{ .Values.deployEnv }}"
SEARCH_ADMIN: "http://elasticsearch-data:9200"
SEARCH_URL: "http://elasticsearch-data:9200"
TURN_SERVER: ''
USE_CLOUDFLARE: false
FRONT_END_URL: "http://www.sefaria.org"
Expand Down
2 changes: 1 addition & 1 deletion build/ci/sandbox-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ localSettings:
DEBUG: false
DOMAIN_LANGUAGE: {}
APSCHEDULER_NAME: "apscheduler-{{ .Values.deployEnv }}"
SEARCH_ADMIN: "http://elasticsearch-data:9200"
SEARCH_URL: "http://elasticsearch-data:9200"
TURN_SERVER: ''
USE_CLOUDFLARE: false
FRONT_END_URL: "http://${NAME}.cauldron.sefaria.org"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ data:
SERVER_EMAIL = os.getenv("SERVER_EMAIL")
auth_str = f'{os.getenv("ELASTIC_USERNAME")}:{os.getenv("ELASTIC_PASSWORD")}@' if os.getenv("ELASTIC_USERNAME") else ''
SEARCH_ADMIN = f'http://{auth_str}' + {os.getenv("SEARCH_HOST")} + ":9200"
SEARCH_URL = f'http://{auth_str}' + {os.getenv("SEARCH_HOST")} + ":9200"
SEARCH_INDEX_ON_SAVE = True
SEARCH_INDEX_NAME_TEXT = 'text' # name of the ElasticSearch index to use
SEARCH_INDEX_NAME_SHEET = 'sheet'
Expand Down
4 changes: 1 addition & 3 deletions helm-chart/sefaria-project/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,7 @@ secrets:
# SEFARIA_DB:
# SEFARIA_DB_USER:
# SEFARIA_DB_PASSWORD:
# SEARCH_ADMIN_USER:
# SEARCH_ADMIN_PW:
# SEARCH_ADMIN_K8S:
# SEARCH_URL
# TURN_SECRET:
# TURN_USER:
# SEFARIA_BOT_API_KEY:
Expand Down
2 changes: 1 addition & 1 deletion reader/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from sefaria.utils.util import text_preview, short_to_long_lang_code, epoch_time
from sefaria.utils.hebrew import hebrew_term, has_hebrew
from sefaria.utils.calendars import get_all_calendar_items, get_todays_calendar_items, get_keyed_calendar_items, get_parasha, get_todays_parasha
from sefaria.settings import STATIC_URL, USE_VARNISH, USE_NODE, NODE_HOST, DOMAIN_LANGUAGES, MULTISERVER_ENABLED, SEARCH_ADMIN, MULTISERVER_REDIS_SERVER, \
from sefaria.settings import STATIC_URL, USE_VARNISH, USE_NODE, NODE_HOST, DOMAIN_LANGUAGES, MULTISERVER_ENABLED, MULTISERVER_REDIS_SERVER, \
MULTISERVER_REDIS_PORT, MULTISERVER_REDIS_DB, DISABLE_AUTOCOMPLETER, ENABLE_LINKER
from sefaria.site.site_settings import SITE_SETTINGS
from sefaria.system.multiserver.coordinator import server_coordinator
Expand Down
4 changes: 2 additions & 2 deletions sefaria/helper/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ def make_filter(type, agg_type, agg_key):

def get_elasticsearch_client():
from elasticsearch import Elasticsearch
from sefaria.settings import SEARCH_ADMIN
return Elasticsearch(SEARCH_ADMIN)
from sefaria.settings import SEARCH_URL
return Elasticsearch(SEARCH_URL)
2 changes: 1 addition & 1 deletion sefaria/local_settings_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
APSCHEDULER_NAME = "apscheduler"

# ElasticSearch server
SEARCH_ADMIN = "http://localhost:9200"
SEARCH_URL = "http://localhost:9200"
SEARCH_INDEX_ON_SAVE = False # Whether to send texts and source sheet to Search Host for indexing after save
SEARCH_INDEX_NAME_TEXT = 'text' # name of the ElasticSearch index to use
SEARCH_INDEX_NAME_SHEET = 'sheet'
Expand Down
2 changes: 1 addition & 1 deletion sefaria/local_settings_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
# URL to connect to ES server.
# Set this to https://sefaria.org/api/search to connect to production search.
# If ElasticSearch server has a password use the following format: http(s)://{username}:{password}@{base_url}
SEARCH_ADMIN = "http://localhost:9200"
SEARCH_URL = "http://localhost:9200"

SEARCH_INDEX_ON_SAVE = False # Whether to send texts and source sheet to Search Host for indexing after save
SEARCH_INDEX_NAME_TEXT = 'text' # name of the ElasticSearch index to use
Expand Down
4 changes: 2 additions & 2 deletions sefaria/search_ES6.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
from sefaria.system.database import db
from sefaria.system.exceptions import InputError
from sefaria.utils.util import strip_tags
from .settings import SEARCH_ADMIN, SEARCH_INDEX_NAME_TEXT, SEARCH_INDEX_NAME_SHEET, STATICFILES_DIRS
from .settings import SEARCH_URL, SEARCH_INDEX_NAME_TEXT, SEARCH_INDEX_NAME_SHEET, STATICFILES_DIRS
from sefaria.site.site_settings import SITE_SETTINGS
from sefaria.utils.hebrew import strip_cantillation
import sefaria.model.queue as qu

es_client = Elasticsearch(SEARCH_ADMIN)
es_client = Elasticsearch(SEARCH_URL)
index_client = IndicesClient(es_client)

tracer = structlog.get_logger(__name__)
Expand Down

0 comments on commit 8a99c92

Please sign in to comment.