Skip to content

How to configure the Search.gov search engine in a new environment

Lora Woodford edited this page Jun 23, 2023 · 6 revisions

Prerequisites

Steps

  1. In the search-gov console, create an I14y drawer with the handle 'searchgov':
I14yDrawer.create!(handle: 'searchgov', description: 'drawer containing documents for the Search.gov search engine')

That should generate a new Elasticsearch index:

$ curl localhost:9200/_cat/indices/*searchgov*/?v
health status index                                   uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   development-i14y-documents-searchgov-v1 7Xam03R8RzOyEzinjV3rcA   1   1          0            0       162b           162b
  1. Populate the drawer

For local test purposes, you can add and index individual URLs manually:

url = SearchgovUrl.create!(url: 'https://search.gov/')
url.fetch
url.reload #you should see 'OK' listed as the `url.last_crawl_status` if the url was successfully indexed
  • Verify the I14y Elasticsearch document associated with that URL:
$ curl localhost:9200/development-i14y-documents-searchgov-v1/_search -d '
{
  "query":
    {
      "term": { "path": "https://search.gov/" }
    }
}'

For bulk & automated indexing, refer to How to Manage Searchgov Domains & indexed content

  1. Create a test affiliate
  • On the "Sites" super admin page, create a new affiliate.
  • Edit that affiliate and set the search engine to "SearchGov".
  • Visit the site admin Domains page for that affiliate (/sites/<affiliate id>/domains), and add your test domain.
  • Visit the search page for your test affiliate (/search?affiliate=<affiliate name>), and run a test search. You should see search results for your test domain, and "Powered by Search.gov" in the bottom right.