{"__v":7,"_id":"5773fb90265b040e00d12c5a","category":{"__v":0,"_id":"57646d30c176520e00ea8fe5","project":"56be3387be55991700c3ca0d","version":"56be3388be55991700c3ca10","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-06-17T21:35:44.598Z","from_sync":false,"order":0,"slug":"clients","title":"Client Integration"},"parentDoc":null,"project":"56be3387be55991700c3ca0d","user":"5633ec9b35355017003ca3f2","version":{"__v":8,"_id":"56be3388be55991700c3ca10","project":"56be3387be55991700c3ca0d","createdAt":"2016-02-12T19:33:28.313Z","releaseDate":"2016-02-12T19:33:28.313Z","categories":["56be3389be55991700c3ca11","57646709b0a8be1900fcd0d8","5764671c89da831700590782","57646d30c176520e00ea8fe5","5764715d4f867c0e002bc8e3","57698fa2e93bfd190028815c","576c2af16c24681700c902da","5787da96b008c91900aae865"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-06-29T16:47:12.264Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"Solr presents a HTTP API for your application to use. Configuration in most cases is a simple matter of providing the URL of your Websolr index to your client.\n\nHere we present a quick tour through the bare minimum you need to know to configure various Solr clients.\n\n## Ruby (Ruby on Rails)\n\n**RSolr**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"solr = RSolr.connect url: \\\"http://index.websolr.com/solr/0a1b2c3d4e5f\\\"\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\n\n**Sunspot**\n\nDirectly in Ruby:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Sunspot.config.solr.url = \\\"http://index.websolr.com/solr/0a1b2c3d4e5f\\\"\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\nAlternately, in a `config/sunspot.yml` file:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"production:\\n  solr:\\n    hostname: index.websolr.com\\n    port: 80\\n    path: /solr/0a1b2c3d4e5f\",\n      \"language\": \"yaml\",\n      \"name\": \"config/sunspot.yml\"\n    }\n  ]\n}\n[/block]\n\n**Tanning Bed** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"TanningBed.solr_connection(\\\"http://index.websolr.com/solr/0a1b2c3d4e5f\\\")\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\n## Python (Django)\n\n**Haystack**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HAYSTACK_SOLR_URL = 'http://index.websolr.com/solr/0a1b2c3d4e5f'\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n**solrpy**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"s = solr.SolrConnection('http://index.websolr.com/solr/0a1b2c3d4e5f')\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n**Sunburnt**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"solr_interface = sunburnt.SolrInterface(\\\"http://index.websolr.com/solr/0a1b2c3d4e5f\\\")\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n\n**pysolr**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"conn = Solr('http://index.websolr.com/solr/0a1b2c3d4e5f')\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n\n## ASP.NET\n\n**SolrNet**\n\n(Where Product is your Solr document mapping class.)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Startup.Init<Product>(\\\"http://index.websolr.com/solr/0a1b2c3d4e5f\\\");\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n## PHP (Zend, CakePHP, CodeIgniter)\n\n**Apache Solr PHP extension**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$options = array (\\n  'hostname' => 'index.websolr.com',\\n  'port' => 80,\\n  'path' => '/solr/0a1b2c3d4e5f'\\n);\\n$client = new SolrClient($options);\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n**Pure PHP client**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$solr = new Apache_Solr_Service('index.websolr.com', 80, '/solr/0a1b2c3d4e5f');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n## Java\n\n**SolrJ**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"SolrServer server = new CommonsHttpSolrServer(\\\"http://index.websolr.com/solr/0a1b2c3d4e5f\\\");\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\nThis documentation is an active work in progress created by Websolr users. Please contribute by suggesting edits!","excerpt":"How to configure your client with Solr for the most popular frameworks.","slug":"client-configuration-overview","type":"basic","title":"Client Configuration Overview"}

Client Configuration Overview

How to configure your client with Solr for the most popular frameworks.

Solr presents a HTTP API for your application to use. Configuration in most cases is a simple matter of providing the URL of your Websolr index to your client. Here we present a quick tour through the bare minimum you need to know to configure various Solr clients. ## Ruby (Ruby on Rails) **RSolr** [block:code] { "codes": [ { "code": "solr = RSolr.connect url: \"http://index.websolr.com/solr/0a1b2c3d4e5f\"", "language": "ruby" } ] } [/block] **Sunspot** Directly in Ruby: [block:code] { "codes": [ { "code": "Sunspot.config.solr.url = \"http://index.websolr.com/solr/0a1b2c3d4e5f\"", "language": "ruby" } ] } [/block] Alternately, in a `config/sunspot.yml` file: [block:code] { "codes": [ { "code": "production:\n solr:\n hostname: index.websolr.com\n port: 80\n path: /solr/0a1b2c3d4e5f", "language": "yaml", "name": "config/sunspot.yml" } ] } [/block] **Tanning Bed** [block:code] { "codes": [ { "code": "TanningBed.solr_connection(\"http://index.websolr.com/solr/0a1b2c3d4e5f\")", "language": "ruby" } ] } [/block] ## Python (Django) **Haystack** [block:code] { "codes": [ { "code": "HAYSTACK_SOLR_URL = 'http://index.websolr.com/solr/0a1b2c3d4e5f'", "language": "python" } ] } [/block] **solrpy** [block:code] { "codes": [ { "code": "s = solr.SolrConnection('http://index.websolr.com/solr/0a1b2c3d4e5f')", "language": "python" } ] } [/block] **Sunburnt** [block:code] { "codes": [ { "code": "solr_interface = sunburnt.SolrInterface(\"http://index.websolr.com/solr/0a1b2c3d4e5f\")", "language": "python" } ] } [/block] **pysolr** [block:code] { "codes": [ { "code": "conn = Solr('http://index.websolr.com/solr/0a1b2c3d4e5f')", "language": "python" } ] } [/block] ## ASP.NET **SolrNet** (Where Product is your Solr document mapping class.) [block:code] { "codes": [ { "code": "Startup.Init<Product>(\"http://index.websolr.com/solr/0a1b2c3d4e5f\");", "language": "csharp" } ] } [/block] ## PHP (Zend, CakePHP, CodeIgniter) **Apache Solr PHP extension** [block:code] { "codes": [ { "code": "$options = array (\n 'hostname' => 'index.websolr.com',\n 'port' => 80,\n 'path' => '/solr/0a1b2c3d4e5f'\n);\n$client = new SolrClient($options);", "language": "php" } ] } [/block] **Pure PHP client** [block:code] { "codes": [ { "code": "$solr = new Apache_Solr_Service('index.websolr.com', 80, '/solr/0a1b2c3d4e5f');", "language": "php" } ] } [/block] ## Java **SolrJ** [block:code] { "codes": [ { "code": "SolrServer server = new CommonsHttpSolrServer(\"http://index.websolr.com/solr/0a1b2c3d4e5f\");", "language": "java" } ] } [/block] This documentation is an active work in progress created by Websolr users. Please contribute by suggesting edits!