Coder Social home page Coder Social logo

violet's Introduction

Violet Build Status

        __        ___ ___
\  / | /  \ |    |__   |
 \/  | \__/ |___ |___  |

A simple search engine in go.

Install

go get -u github.com/cosmtrek/violet

# dont forget add `violet` environment variable
# vi ~/.bash_profile
export violet='$GOPATH/src/github.com/cosmtrek/violet'

There are two modes for violet, one is for guys who loves terminal like me, the another is running as http server.

Terminal Mode

violet -path=INDEX_PATH -index=INDEX_NAME -fields=INDEX_FIELDS -data=DATA_FILE -query=true -server=false

Then you can search anything you feed in.

Server Mode

# start server
violet

After the server is started, open another terminal to make a post request to create index.

# first create a json file post.json
{
    "index": "INDEX_NAME",
    "index_path": "INDEX_PATH",
    "fields": "INDEX_FIELDS",
    "datafile": "DATA_FILE"
}
# then create index
curl -XPOST -d @./data/tweets.json "http://localhost:6060/index"
# try to query
curl "http://localhost:6000/INDEX_NAME/search?query=TERM"

Query

In order to search with efficiency, it's necessary to query something with conditions. Currently only support following forms:

  1. word search single word
  2. word1 word2 search multiple words
  3. word1 -word2 search word1 and excludes word2
  4. field1:word1 field2:word2 search word1 in field1 and word2 in field2
  5. word field>10 search word and field(integer) is greater than 10

Demo

Tweets Search

It searches my tweets stored in ./data/tweets.

violet's People

Contributors

cosmtrek avatar

Watchers

 avatar

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.