This is the backend of the JudaicaLink search functionality. It is developed in node.js and basically takes requests from the JavaScript search.js running on the client's Webbrowser, passes on the request to ElasticSearch and then returning the ElasticSearch result back to the browser, where it is displayed.
+----------------------------+ +---------------------------+ +---------------+
| | | | | |
| Repo: judaicalink-site | | Repo: judaicalink-search | | |
| File: static/js/search.js +----> File: static/js/search.js +----> ElasticSearch |
| Running in the Web browser | | This backend. | | |
| | | | | |
| | | | | |
+----------------------------+ +---------------------------+ +---------------+
The browser invokes the search() function that is productively deployed here:
judaicalink-site:/static/js/search.jd
This function calls the public backend under http://search.judaicalink.org
For development purposes, there is a local version with a corresponding minimalistic HTML page in the repo:
If you use a local ElasticSearch, simply change the backend URL there, but make sure that you change it back to the public URL whenever you copy the code over to the website!
The main action happens in this file, where requests to /search/:query are processed.
- Clone this repo:
git clone [email protected]:wisslab/judaicalink-search.git
- cd into the repo directory:
cd judaicalink-search
- Install dependencies:
npm install
- Run the backend:
npm start
- Go to http://localhost:3000 to run a test search.
The ElasticSearch server that actually provides the data. The production version is running on our Web server, but not directly accessible from outside.
The data to be loaded to ElasticSearch should be a json file with a specific format in which each object is distinguished with an id-index. Therefore, to load the JudaicaLink datasets to ElasticSearch they were first transformed into the required format. To do so the Python scripts in the tools directory were used to generated the json files.
Then the generated json files were loaded as _bulk data to ElasticSearch as follow:
curl -H "Content-Type:application/json" -XPOST "localhost:9200/judaicalink/doc/_bulk?pretty" --data-binary @filename.json
You can setup a local version following these instructions: (TODO!)