diff --git a/Dockerfile b/Dockerfile index ab41779..06baf28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,8 @@ ENV PORT=80 \ ELASTICSEARCH_URL=elasticsearch:9200 \ ELASTICSEARCH_INDEX=images \ ELASTICSEARCH_DOC_TYPE=images \ - ALL_ORIENTATIONS=true + ALL_ORIENTATIONS=true \ + DISTANCE_CUTOFF=0.45 CMD gunicorn \ -t 60 \ diff --git a/Makefile b/Makefile index 0acbef3..d14e2be 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ export PORT ?= 8888 export ELASTICSEARCH_URL ?= elasticsearch:9200 export ELASTICSEARCH_INDEX ?= images export ELASTICSEARCH_DOC_TYPE ?= images +export DISTANCE_CUTOFF ?= 0.45 all: run @@ -21,6 +22,7 @@ run: build -e ELASTICSEARCH_URL \ -e ELASTICSEARCH_INDEX \ -e ELASTICSEARCH_DOC_TYPE \ + -e DISTANCE_CUTOFF \ -p $(PORT):$(PORT) \ -it $(DOCKER_TAG) diff --git a/README.md b/README.md index 4877069..f3671b9 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ spec: env: - name: WORKER_COUNT value: "4" + - name: DISTANCE_CUTOFF + value: 0.45 - name: ELASTICSEARCH_URL valueFrom: secretKeyRef: diff --git a/rc.yml b/rc.yml index 02aefbd..5b088be 100644 --- a/rc.yml +++ b/rc.yml @@ -19,6 +19,8 @@ spec: env: - name: WORKER_COUNT value: "4" + - name: DISTANCE_CUTOFF + value: 0.45 - name: ELASTICSEARCH_URL valueFrom: secretKeyRef: diff --git a/server.py b/server.py index 478c3ab..9b7d03e 100644 --- a/server.py +++ b/server.py @@ -13,10 +13,11 @@ es_index = os.environ['ELASTICSEARCH_INDEX'] es_doc_type = os.environ['ELASTICSEARCH_DOC_TYPE'] all_orientations = os.environ['ALL_ORIENTATIONS'] +distance_cutoff_param = float(os.environ.get('DISTANCE_CUTOFF', 0.45)) app = Flask(__name__) es = Elasticsearch([es_url], verify_certs=True, timeout=60, max_retries=10, retry_on_timeout=True) -ses = SignatureES(es, index=es_index, doc_type=es_doc_type) +ses = SignatureES(es, index=es_index, doc_type=es_doc_type, distance_cutoff=distance_cutoff_param) gis = ImageSignature() # Try to create the index and ignore IndexAlreadyExistsException