SolrClient
This is the simple Apache Solr client for Scala.
Value members
Concrete methods
Execute batch updating.
Execute batch updating.
Note --- VERY IMPORTANT ---: You MUST supply a collection when instantiating the client or you will see an NPE
Note: To register documents actual, you have to call commit after added them.
import jp.sf.amateras.solr.scala._
val client = new SolrClient("http://localhost:8983/solr/collection") <-- collection included in URI
client.add(Map("id"->"001", "manu" -> "Lenovo", "name" -> "ThinkPad X201s"))
.add(Map("id"->"002", "manu" -> "Lenovo", "name" -> "ThinkPad X202"))
.add(Map("id"->"003", "manu" -> "Lenovo", "name" -> "ThinkPad X100e"))
.commit
Execute batch updating on the specified collection.
Execute batch updating on the specified collection.
Note: To register documents actual, you have to call commit after added them.
import jp.sf.amateras.solr.scala._
val client = new SolrClient("http://localhost:8983/solr") <-- No collection at end of URI
client.addToCollection("collection", Map("id"->"001", "manu" -> "Lenovo", "name" -> "ThinkPad X201s"))
.add(Map("id"->"002", "manu" -> "Lenovo", "name" -> "ThinkPad X202"))
.add(Map("id"->"003", "manu" -> "Lenovo", "name" -> "ThinkPad X100e"))
.commit
Commit the current session on a specified collection
Commit the current session on a specified collection
Delete the document which has a given id.
See note about client instantiation in add
documentation
Delete the document which has a given id.
See note about client instantiation in add
documentation
- Value Params
- id
the identifier of the document to delete
Delete the document which has a given id in the specified collection.
Delete the document which has a given id in the specified collection.
- Value Params
- collection
the name of the collection
- id
the identifier of the document to delete
Delete documents by the given query.
See note about client instantiation in add
documentation
Delete documents by the given query.
See note about client instantiation in add
documentation
- Value Params
- params
the parameter map which would be given to the query
- query
the solr query to select documents which would be deleted
Delete documents by the given query on the specified collection.
Delete documents by the given query on the specified collection.
- Value Params
- collection
the name of the collection
- params
the parameter map which would be given to the query
- query
the solr query to select documents which would be deleted
Check the status of the server You HAVE TO instantiate the client with a collection b/c /solr/admin/ping does not exist.
Check the status of the server You HAVE TO instantiate the client with a collection b/c /solr/admin/ping does not exist.
val client = new SolrClient("http://localhost:8983/solr/collection")
val result: SolrPingResponse = client.ping
Search documents using the given query, note the difference in instantiation as well as use of method collection
Search documents using the given query, note the difference in instantiation as well as use of method collection
import jp.sf.amateras.solr.scala._
val client = new SolrClient("http://localhost:8983/solr")
val result: List[Map[String, Any]] =
client.query("*:*")
.collection("collection") <-- Required or you'll be searching /solr/select
.fields("id", "manu", "name")
.sortBy("id", Order.asc)
.getResultAsMap()
--- OR ---
val client = new SolrClient("http://localhost:8983/solr/collection")
val result: List[Map[String, Any]] =
client.query("*:*")
.fields("id", "manu", "name")
.sortBy("id", Order.asc)
.getResultAsMap()
Add documents and commit them immediately.
See note about client instantiation in add
documentation
Add documents and commit them immediately.
See note about client instantiation in add
documentation
- Value Params
- docs
documents to register
Add documents and commit them immediately to the specified collection.
Add documents and commit them immediately to the specified collection.
- Value Params
- collection
the name of the collection
- docs
documents to register
Shutdown this solr client to release allocated resources.
Shutdown this solr client to release allocated resources.
Execute given operation in the transaction.
Execute given operation in the transaction.
The transaction is committed if operation was successful. But the transaction is rolled back if an error occurred.