Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

…rch 7 (#131)

* SRCH-1754 update Elasticsearch initializer & client (#128)
* SRCH-1743 create repository classes (#130)
* SRCH-1755 upgrade elasticsearch gems to 6.x (#134)
* SRCH-1819 return total search hits as an integer (#138)
* SRCH-1818 set minimum_should_match to 1 in bool filter (#139)
* SRCH-1730 update templates (#137)
* SRCH-1820 add Elasticsearch & Kibana 7 to docker-compose.yml (#136)
* SRCH-1718 run specs against Elasticsearch 6 & 7 (#140)
* SRCH-1876 fix intermittent spec failures (#141)
- replace patron with typhoeus
- bump nokogiri
* SRCH-1854 set ID when deserializing (#142)
* SRCH-1822 placate Rubocop (#143)
90a5b04

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
bin
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

i14y

CircleCI Code Climate Test Coverage

Search engine for agencies' published content

Dependencies/Prerequisites

  • Ruby

Use rvm to install the version of Ruby specified in .ruby-version.

We recommend using Docker to install and run Elasticsearch:

$ docker-compose up elasticsearch

Verify that Elasticsearch 6.8.x is running on port 9200:

$ curl localhost:9200
{
  "name" : "wp9TsCe",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "WGf_peYTTZarT49AtEgc3g",
  "version" : {
    "number" : "6.8.7",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "c63e621",
    "build_date" : "2020-02-26T14:38:01.193138Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.2",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
  • Kibana

Kibana is not required, but it can very helpful for debugging your Elasticsearch cluster or data. You can also run Kibana using Docker:

$ docker-compose up kibana

Verify that you can access Kibana in your browser: http://localhost:5601/

For development purposes, you can run versions 6 & 7 of both Elasticsearch & Kibana in parallel:

$ docker-compose up

To develop and test using Elasticsearch 7, specify 9271 as the Elasticsearch port:

$ ES_PORT=9271 bundle exec rake

Kibana 7 is configured to run on port 5671: http://localhost:5671/

Development

  • bundle install.
  • Copy config/secrets_example.yml to config/secrets.yml and fill in your own secrets. To generate a random long secret, use rake secret.
  • Run bundle exec rake i14y:setup to create the neccessary indexes, index templates, and dynamic field templates.

If you ever want to start from scratch with your indexes/templates, you can clear everything out: bundle exec rake i14y:clear_all

  • Run the Rails server on port 8081 for compatibility with the search-gov app:
$ rails s -p 8081

You should see the default Rails index page on http://localhost:8081/.

Basic Usage

Create a collection for storing documents

$ curl -u dev:devpwd -XPOST http://localhost:8081/api/v1/collections \
 -H "Content-Type:application/json" -d \
 '{"handle":"test_collection","description":"my test collection","token":"test_collection_token"}'

Create a document within that collection

Use the collection handle and token for authorization:

curl http://localhost:8081/api/v1/documents \
  -XPOST \
  -H "Content-Type:application/json" \
  -u test_collection:test_collection_token \
  -d '{"document_id":"1",
      "title":"a doc about rutabagas",
      "path": "http://www.foo.gov/rutabagas.html",
      "created": "2020-05-12T22:35:09Z",
      "description":"Lots of very important info on rutabagas",
      "content":"rutabagas",
      "promote": false,
      "language" : "en",
      "tags" : "tag1, another tag"
      }'

Search for a document within a collection

$ curl -u dev:devpwd http://localhost:8081/api/v1/collections/search?handles=test_collection&query=rutabaga

Tests

# Fire up Elasticsearch
$ docker-compose up elasticsearch

$ bundle exec rake i14y:setup
$ rake