Skip to content

srinadhupreetham/query-server

 
 

Repository files navigation

Query-Server

Build Status Dependency Status Join the chat at https://gitter.im/fossasia/query-server

The query server can be used to search a keyword/phrase on a search engine (Google, Yahoo, Bing, DuckDuckGo) and get the results as json or xml. The tool also stores the searched query string in a MongoDB database for analytical purposes. (The search engine scrapper is based on the scraper at fossasia/searss.)

Deploy

Table of Contents

API

The API(s) provided by query-server are as follows:

GET /api/v1/search/<search-engine>?query=query&format=format

search-engine : ['google' , 'bing', 'duckduckgo' , 'yahoo']

query : query can be any string

format : [ json, xml ]

A sample query : /api/v1/search/bing?query=fossasia&format=xml

Error Codes

404 Not Found : Incorrect Search Engine, Zero Response
400 Bad Request : query and/or format is not in the correct format

Dependencies

Installation

Make sure you have Nodejs installed. Running this tool requires installing the nodejs as well as python dependencies.

git clone https://github.com/fossasia/query-server.git 
cd query-server
npm install -g bower
bower install
pip install -r requirements.txt

To set up MongoDB on your server :

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start

Usage

To run the query server:

python app/server.py

Contribute

Found an issue? Post it in the issue tracker

License

This project is currently licensed under the Apache License version 2.0. A copy of LICENSE should be present along with the source code. To obtain the software under a different license, please contact FOSSASIA.

Releases

No releases published

Packages

No packages published

Languages

  • Python 55.6%
  • HTML 39.9%
  • CSS 4.5%