Sign inSign up

qwazr/search

By qwazr

•Updated about 4 years ago

Apache Lucene Search Engine

Image
2

1.3K

qwazr/search repository overview

A Search Engine microservice and JAVA library with indexing and search features based on Apache Lucene⁠

Documentation Build Status Maven Central Coverage Status Join the chat at https://gitter.im/qwazr/QWAZR License

⁠Getting started

⁠Get the image from Docker Hub and run it:
 docker pull qwazr/search 
 docker run -p 9091:9091 qwazr/search
 
 
⁠Create an index:

We set the primary key to the property "id", and the json record will be stored in a property called "record".

 curl -XPOST -H "Content-Type: application/json" \
    -d '{"primary_key":"id","record_field":"record"}' \
    http://localhost:9091/indexes/my_index
⁠Add a document to the index:
 curl -XPOST -H "Content-Type: application/json" \
    -d '{"id": 1, "title":"my article", "rating": 5}' \
    http://localhost:9091/indexes/my_index/json

For instance, we will use a JSON file called "my_search" to store the search query:

{
  "start": 0,
  "rows": 10,
  "query": {
    "SimpleQueryParser": {
	"analyzer": "ascii",
    "query_string": "Article",
    "weights": {
       "title": 1
     }
   }
  },
  "returned_fields": [
    "*"
  ]
}

We can run the query by posting it:

 curl -XPOST -H 'Content-Type: application/json' \
    -d @my_search.json \
     http://localhost:9091/indexes/my_index/search

And voila:

{
  "timer" : {
    "start_time" : "2020-09-08T23:30:40.330+00:00",
    "total_time" : 2
  },
  "documents" : [ {
    "score" : 0.13076457,
    "pos" : 0,
    "fields" : {
      "id" : 1,
      "title" : "my article",
      "rating" : 5
    }
  } ],
  "facets" : { },
  "total_hits" : 1
}    

Tag summary

Content type

Image

Digest

sha256:6a1d7fe36…

Size

155.1 MB

Last updated

about 4 years ago

docker pull qwazr/search