Coder Social home page Coder Social logo

customsearch's Introduction

Search a MySQL table through HTTP requests

(but with very little change sure it'd work with other DB engines)

This project is bascally two things (will refactor and separate them):

  • A search module built upon Sequelize for generating custom queries to search strings in all (or specified) fields in a database table
  • An HTTP interface for that module

The module generates big SQL query with tons of: a LIKE "%something%" OR b LIKE "%something%" OR ..., etc., depending on the match type requested.

Originally developed for personal use but it might be useful to someone else.

Soon will be publishing the search module separate from the server for the HTTP interface

Install

$ npm install

Will automatically run node configure.js, which asks for connection data, database name, table, fields to search and fields to return.

Use

$ PORT=4444 npm start

if no port specified will listen on 3000

Endpoints

A public dir is provided so one can load or link in there apps for debugging purposes, including a current demo. Serve from public in production env is discouraged.

Configure

Run $ node configure.js, then copy config.json.generated to config.json

(This script auto-runs after npm install)

Also you can manually set configurations copying config.json.sample to config.json and writing there.

Nginx proxy

To expose this API publically configure your web server to proxy requests to the port on which is running.

E.g to setup in http://my-domain.com/customsearch add to the my-domain.com vhost:

server {
	listen 80;
	server_name my-domain.com;

	# ... vhost configurations

	location /customsearch/ {
	    proxy_set_header   X-Real-IP $remote_addr;
	    proxy_set_header   Host      $http_host;
	    proxy_pass         http://localhost:3000/; # the port where its listening
	}
}

License

MIT

customsearch's People

Contributors

tincho avatar

Stargazers

 avatar

Watchers

 avatar  avatar

customsearch's Issues

buscar "todas las palabras" en todas las columns por row, no todas juntas en una sola

al buscar con type = ALL ( "todas las palabras" )

sólo devuelve aquellos resultados en que todas las palabras estén presentes en el mismo campo/columna

sería deseable que :

  • al buscar "one two three"
  • con type=ALL
    encuentre aquellas filas que
  • contengan todas las palabras pero no necesariamente en la misma columna, sino por ejemplo en una columna "one" y "two", y en otra columna "three"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.