The Search module provides a backend search service for the MoboSearch project, using also the json information in the App Interchange Format.
The backend search service is derived from OpenSearch, so first you need to install it. After that, you should install ‘Node.js’ and ‘npm’ in your system. After that, you should install ‘Node.js’ and ‘npm’ in your system. Once these packages have been installed you can proceed to download the code and install its dependencies by running npm install
.
At this point, you can launch a server on localhost:9000
(localhost, port 9000) that exposes an endpoint in /search
allowing clients to perform searches.
The backend search service is composed of two modules: search web server and search utility functions.
The search web server exposes an endpoint in /search
; clients can query it including the mandatory parameter text
. The result of this request is a list of applications that contains the searched text in the title or in the description, sorted using the selected privacy score. Clients can specify additional parameters such as size
and page
to receive a fixed amount of results for each page.
The search utility functions are a set of utilities made to allow an easy search management. Specifically, with these utilities you can create a new index, delete an existing index, list indices, get indices status, add documents to an index, remove documents and retrieve documents.
The script index
is used to manage the indexes:
Command line: index -h —help show this help message and exit -a —action action to perform between: “create”, “delete”, “get” and “check” -n —name index nameIn particular:
./index --action "create" --name "name"
./index --action "delete" --name "name"
./index --action "get" --name "name"
./index --action "check" --name index_name
The other script, document
is used to manage documents within an index:
Command line: document -h —help show this help message and exit -a —action action to perform between: “index”, “delete”, and “get” -n —index_name index name -i —id id of the document -d —dir files directory to addIn particular:
./document --action "index" --index_name "name" file_path
./document --action "index" --index_name "name" --dir directory
./document --action "delete" --index_name "name" --id "id"
./document --action "get" --index_name "name" --id "id"
There is a live demo of the search module (with a bare-minimum demo layout: that will be of course completely refined, both aestetically and textually, when launching the full web site) online at http://test.mobosearch.top/.
The source code of the module can be directly downloaded here (note that at public launch we will also provide a GitHub link), as well as the templates used to generate the online demo (used by JsonWeb, together with the selected app data in AIF format, to automatically generate the website).