Skip to content

Commit d015bd0

Browse files
authored
Merge pull request #57 from victordibia/dev
Fix username/password bug, add ui build to enable easier local setup
2 parents a38e9fd + c77eba7 commit d015bd0

30 files changed

+217
-13
lines changed

docs/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ Launch the web interface via command line:
2424
2525
neuralqa ui --port 5000
2626
27+
You can also clone this repository, make changes and launch the application directly from repository:
28+
29+
.. code-block:: shell
30+
31+
python neuralqa/cli.py ui
32+
33+
34+
2735
.. image:: https://raw.githubusercontent.com/victordibia/neuralqa/master/docs/images/manual.jpg
2836
:width: 100%
2937
:alt: NeuralQA User Interface Screenshot

neuralqa/config_default.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@ retriever:
6262
value: "none"
6363
type: "none"
6464

65-
6665
# - name: Case Law
6766
# value: cases
68-
# host: localhost
69-
# port: 9200
70-
# username: None
71-
# password: None
7267
# type: elasticsearch
73-
# fields:
68+
# connection:
69+
# host: localhost
70+
# port: 9200
71+
# username: ""
72+
# password: ""
7473
# body_field: "casebody.data.opinions.text"
7574
# - name: Medical
7675
# value: medical

neuralqa/retriever/elasticsearchretriever.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@
88

99

1010
class ElasticSearchRetriever(Retriever):
11-
def __init__(self, index_type="elasticsearch", host="localhost", port=9200, **kwargs):
11+
def __init__(self, index_type="elasticsearch", host="localhost", port=9200, username="", password="", **kwargs):
1212
Retriever.__init__(self, index_type)
1313

14-
self.username = ""
15-
self.password = ""
14+
self.username = username
15+
self.password = password
1616
self.body_field = ""
1717
self.host = host
1818
self.port = port
19-
2019
allowed_keys = list(self.__dict__.keys())
2120
self.__dict__.update((k, v)
2221
for k, v in kwargs.items() if k in allowed_keys)
23-
self.es = Elasticsearch([{'host': self.host, 'port': self.port}])
22+
23+
print(self.__dict__)
24+
# self.es = Elasticsearch(
25+
# [{'host': self.host, 'port': self.port,
26+
# "username": self.username, "password": self.password}])
27+
self.es = Elasticsearch(hosts=[{"host": self.host, "port": self.port}],
28+
http_auth=(self.username, self.password))
2429
self.isAvailable = self.es.ping()
2530

2631
rejected_keys = set(kwargs.keys()) - set(allowed_keys)

neuralqa/retriever/retrieverpool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, retrievers):
1616

1717
if (retriever["type"] == "elasticsearch"):
1818
self.retriever_pool[retriever["value"]] = ElasticSearchRetriever(
19-
host=retriever["host"], port=retriever["port"], body_field=retriever["fields"]["body_field"])
19+
**retriever["connection"])
2020
if (retriever["type"] == "solr"):
2121
logger.info("We do not yet support Solr retrievers")
2222
self.selected_retriever = retrievers["selected"]

neuralqa/server/ui/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public/images/extra
99
/coverage
1010

1111
# production
12-
# /build
12+
!build
1313

1414
# misc
1515
.DS_Store
8.65 KB
Loading
31.9 KB
Loading
7.79 KB
Loading
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"files": {
3+
"main.css": "/static/css/main.0d7f6602.chunk.css",
4+
"main.js": "/static/js/main.32abfeaf.chunk.js",
5+
"main.js.map": "/static/js/main.32abfeaf.chunk.js.map",
6+
"runtime-main.js": "/static/js/runtime-main.985d1449.js",
7+
"runtime-main.js.map": "/static/js/runtime-main.985d1449.js.map",
8+
"static/js/2.17f05cd8.chunk.js": "/static/js/2.17f05cd8.chunk.js",
9+
"static/js/2.17f05cd8.chunk.js.map": "/static/js/2.17f05cd8.chunk.js.map",
10+
"index.html": "/index.html",
11+
"precache-manifest.f2ddb522e87f24d57699361b5d062612.js": "/precache-manifest.f2ddb522e87f24d57699361b5d062612.js",
12+
"service-worker.js": "/service-worker.js",
13+
"static/css/main.0d7f6602.chunk.css.map": "/static/css/main.0d7f6602.chunk.css.map",
14+
"static/js/2.17f05cd8.chunk.js.LICENSE.txt": "/static/js/2.17f05cd8.chunk.js.LICENSE.txt"
15+
},
16+
"entrypoints": [
17+
"static/js/runtime-main.985d1449.js",
18+
"static/js/2.17f05cd8.chunk.js",
19+
"static/css/main.0d7f6602.chunk.css",
20+
"static/js/main.32abfeaf.chunk.js"
21+
]
22+
}
394 Bytes
Loading

0 commit comments

Comments
 (0)