Skip to content

Instantly share code, notes, and snippets.

@daveshah
Created January 21, 2016 20:37
Show Gist options
  • Save daveshah/c908d8336e7b2f99209c to your computer and use it in GitHub Desktop.
Save daveshah/c908d8336e7b2f99209c to your computer and use it in GitHub Desktop.
(non-working) attempt at DIH into Solr
def "Loading into the solr core"() {
given: "An empty solr core"
def solrServer = new EmbeddedSolrServer(Paths.get("../solr"), "corename")
when: "I load the core"
def params = new ModifiableSolrParams(){{
add("command","full-import")
add("clean","true")
add("commit","true")
}}
solrServer.request(new GenericSolrRequest(SolrRequest.METHOD.POST,"/dataimport",params))
then: "I should recieve documents from Solr"
def responseWithResults = solrServer.query(new ModifiableSolrParams() {
{
add("q", "*:*")
}
})
def expectedNumberOfResults = 10
def numberOfResultsFromTheSolrQuery = responseWithResults.results.size()
expectedNumberOfResults == numberOfResultsFromTheSolrQuery
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment