{"id":13735230,"url":"https://github.com/seratch/scalikesolr","last_synced_at":"2025-05-08T11:32:42.203Z","repository":{"id":57722695,"uuid":"1774810","full_name":"seratch/scalikesolr","owner":"seratch","description":"Apache Solr Client for Scala/Java","archived":true,"fork":false,"pushed_at":"2016-01-11T02:45:32.000Z","size":77578,"stargazers_count":51,"open_issues_count":1,"forks_count":17,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2024-08-25T00:51:48.595Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://seratch.github.com/scalikesolr/","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seratch.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-05-20T04:22:03.000Z","updated_at":"2023-01-28T13:21:37.000Z","dependencies_parsed_at":"2022-08-28T10:11:26.048Z","dependency_job_id":null,"html_url":"https://github.com/seratch/scalikesolr","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2Fscalikesolr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2Fscalikesolr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2Fscalikesolr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2Fscalikesolr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seratch","download_url":"https://codeload.github.com/seratch/scalikesolr/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224727173,"owners_count":17359532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T03:01:04.489Z","updated_at":"2024-11-15T03:31:34.838Z","avatar_url":"https://github.com/seratch.png","language":"Scala","funding_links":[],"categories":["Clients"],"sub_categories":["Scala"],"readme":"# Important Notice\n\nThis library is no longer actively maintained. If you'd like to reuse the implementation, please fork this repository or ask me to add you to the collaborators (I can still work on releasing libs onto sonatype and Maven central).\n\n# ScalikeSolr : Apache Solr Client for Scala/Java\n\n\"ScalikeSolr\" is a simple Solr client library for Scala. And it also works fine with Java.\n\n## How to install\n\n### sbt\n\n```scala\nlibraryDependencies ++= Seq(\n  \"com.github.seratch\" %% \"scalikesolr\" % \"4.10.0\"\n)\n```\n\n### Maven\n\nAvailable on maven central repository.\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.seratch\u003c/groupId\u003e\n  \u003cartifactId\u003escalikesolr_2.11\u003c/artifactId\u003e\n  \u003cversion\u003e4.9.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\n### Query\n\n#### Simple Query\n\nUsing [Core Query Paramters](http://wiki.apache.org/solr/CoreQueryParameters) and [Common Query Parameters](http://wiki.apache.org/solr/CommonQueryParameters):\n\n```scala\nimport com.github.seratch.scalikesolr._\n\nval client = Solr.httpServer(new URL(\"http://localhost:8983/solr\")).newClient\nval request = new QueryRequest(query = Query(\"author:Rick\")) \nval response = client.doQuery(request)\nprintln(response.responseHeader)\nprintln(response.response)\nresponse.response.documents foreach {\n  case doc =\u003e {\n    println(doc.get(\"id\").toString()) // \"978-1423103349\"\n    println(doc.get(\"cat\").toListOrElse(Nil).toString) // List(book, hardcover)\n    println(doc.get(\"title\").toString()) // \"The Sea of Monsters\"\n    println(doc.get(\"pages_i\").toIntOrElse(0).toString) // 304\n    println(doc.get(\"price\").toDoubleOrElse(0.0).toString) // 6.49\n  }\n}\n```\n\n#### Bind from SolrDocument\n\nIt requires no-argument constructor and setters for fields.\nIt is also possible to specify user-defined type that has one argument(String) constructor.\n\n```scala\ncase class PageI(val value: String = \"\")\ncase class Book(\n  var id: String = \"\",\n  var cat: List[String] = Nil,\n  var price: Double = 0.0,\n  var pageI: PageI = PageI(),\n  var sequenceI: Int = 0 ) {\n  def this() = {\n    this (\"\", Nil, 0.0, PageI(), 0)\n  }\n}\nval book = doc.bind(classOf[Book])\nprintln(book.id) // \"978-1423103349\"\nprintln(book.cat.size) // 2\nprintln(book.price) // 6.49\nprintln(book.pageI.value) // 304\nprintln(book.sequenceI) // 2\n```\n\nSee the [documentation](https://github.com/seratch/scalikesolr/wiki) for more detail.\n\n\n\n## Using in Java\n\nThis library works fine with Java.\n\n### Query\n\n```java\nSolrClient client = Solr.httpServer(new URL(\"http://localhost:8983/solr\")).getNewClient();\nQueryRequest request = new QueryRequest(Query.as(\"author:Rick\")); // or new Query(\"author:Rick\")\nrequest.setSort(Sort.as(\"author desc\"));\nrequest.setMoreLikeThis(MoreLikeThisParams.as(true, 3, FieldsToUseForSimilarity.as(\"title\")));\nQueryResponse response = client.doQuery(request);\nList\u003cSolrDocument\u003e documents = response.getResponse().getDocumentsInJava();\nfor (SolrDocument document : documents) {\n  log.debug(document.get(\"id\").toString()); // \"978-1423103349\"\n  log.debug(document.get(\"cat\").toListInJavaOrElse(null).toString()); // [\"book\", \"paperback\"]\n  log.debug(document.get(\"pages_i\").toNullableIntOrElse(null).toString()); // 304\n  log.debug(document.get(\"price\").toNullableDoubleOrElse(null).toString()); // 6.49\n}\n```\n\n#### Bind from SolrDocument\n\n```java\npublic class PageI {\n  private String value;\n  public PageI(String value) { this.value = value; }\n  public String getValue() { return value; }\n}\n\npublic class Book {\n  private String id;\n  private List\u003cString\u003e cat;\n  private Double price;\n  private PageI pageI;\n  private Integer sequenceI;\n  public String getId() { return id; }\n  public void setId(String id) { this.id = id; }\n  // ... getter/setter\n}\n\nSolrDocument document = ...;\nBook book = document.bindInJava(Book.class);\nlog.debug(book.getId()); // \"978-1423103349\"\nlog.debug(book.getCat().toString()); // [book]\nlog.debug(book.getPrice().toString()); // \"6.49\"\nlog.debug(book.getPageI().getValue()); // \"304\"\nlog.debug(book.getSequenceI().toString()); // \"2\"\n```\n\nSee the [documentation](https://github.com/seratch/scalikesolr/wiki) for more detail.\n\n\n## License\n\nApache License, Version 2.0 \n\nhttp://www.apache.org/licenses/LICENSE-2.0.html\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseratch%2Fscalikesolr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseratch%2Fscalikesolr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseratch%2Fscalikesolr/lists"}