Class

com.github.takezoe.solr.scala

SolrClient

Related Doc: package scala

Permalink

class SolrClient extends AnyRef

This is the simple Apache Solr client for Scala.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SolrClient
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SolrClient(url: String)(implicit factory: (String) ⇒ org.apache.solr.client.solrj.SolrClient = ..., parser: ExpressionParser = new DefaultExpressionParser())

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def add(docs: Any*): BatchRegister

    Permalink

    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
  5. def addToCollection(collection: String, docs: Any*): BatchRegister

    Permalink

    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
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def commit(): UpdateResponse

    Permalink

    Commit the current session.

  9. def commit(collection: String): UpdateResponse

    Permalink

    Commit the current session on a specified collection

  10. def deleteById(collection: String, id: String): UpdateResponse

    Permalink

    Delete the document which has a given id in the specified collection.

    Delete the document which has a given id in the specified collection.

    collection

    the name of the collection

    id

    the identifier of the document to delete

  11. def deleteById(id: String): UpdateResponse

    Permalink

    Delete the document which has a given id.

    Delete the document which has a given id. See note about client instantiation in add documentation

    id

    the identifier of the document to delete

  12. def deleteByQuery(query: String, params: Map[String, Any] = Map()): UpdateResponse

    Permalink

    Delete documents by the given query.

    Delete documents by the given query. See note about client instantiation in add documentation

    query

    the solr query to select documents which would be deleted

    params

    the parameter map which would be given to the query

  13. def deleteByQueryForCollection(collection: String, query: String, params: Map[String, Any] = Map()): UpdateResponse

    Permalink

    Delete documents by the given query on the specified collection.

    Delete documents by the given query on the specified collection.

    collection

    the name of the collection

    query

    the solr query to select documents which would be deleted

    params

    the parameter map which would be given to the query

  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. def ping: SolrPingResponse

    Permalink

    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
  24. def query(query: String): QueryBuilder

    Permalink

    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()
  25. def register(docs: Any*): UpdateResponse

    Permalink

    Add documents and commit them immediately.

    Add documents and commit them immediately. See note about client instantiation in add documentation

    docs

    documents to register

  26. def registerToCollection(collection: String, docs: Any*): UpdateResponse

    Permalink

    Add documents and commit them immediately to the specified collection.

    Add documents and commit them immediately to the specified collection.

    collection

    the name of the collection

    docs

    documents to register

  27. def rollback(): UpdateResponse

    Permalink

    Rolled back the current session.

  28. def rollback(collection: String): UpdateResponse

    Permalink

    Rolled back the current session on a collection

  29. def shutdown(): Unit

    Permalink

    Shutdown this solr client to release allocated resources.

  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  32. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. def withTransaction[T](operations: ⇒ T): T

    Permalink

    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.

  36. def withTransactionOnCollection[T](collection: String)(operations: ⇒ T): T

    Permalink

    Execute given operation in the transaction to a collection

    Execute given operation in the transaction to a collection

    The transaction is committed if operation was successful. But the transaction is rolled back if an error occurred.

Inherited from AnyRef

Inherited from Any

Ungrouped