{"_id":"576b0f47a3eb7a2b00424319","__v":9,"category":{"_id":"57698fa2e93bfd190028815c","version":"56be3388be55991700c3ca10","project":"56be3387be55991700c3ca0d","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-06-21T19:04:02.961Z","from_sync":false,"order":1,"slug":"integrations","title":"Guides"},"version":{"_id":"56be3388be55991700c3ca10","project":"56be3387be55991700c3ca0d","__v":8,"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"},"parentDoc":null,"project":"56be3387be55991700c3ca0d","user":"5633ec9b35355017003ca3f2","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-06-22T22:20:55.854Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"In this guide, we're going to cover the basics of setting up a websolr index to be used with [Drupal 7](https://drupal.org/drupal-7.22-release-notes) and the [Search API Solr](https://drupal.org/project/search_api_solr) module. A few points to note before we get started:\n\n- This example uses Drupal 7.22 and Search API Solr version 7.x-1.1. Your versions may vary; as long as the major versions are the same, you can reliably use this guide.\n- This guide is not meant to be an exhaustive tutorial on all of the things the Search API Solr module can do. The goal here is to get you up and running quickly, then let you tune things as necessary.\n- If you run into issues while following this guide, make sure to check the \"Troubleshooting\" section at the bottom and see if a soluton is addressed there.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Getting started\"\n}\n[/block]\nFor the purposes of this tutorial, I set up a vanilla Drupal 7 install. I used the Devel module to generate 50 nodes of random content so we would have something to index later. After my dummy content was created, I uninstalled and removed this module. I then prepped the site by:\n\n- Downloaded and extracted the following to `sites/all/modules`: [Search API](https://drupal.org/project/search_api), [Search API Solr](https://drupal.org/project/search_api_solr), [Entity](https://drupal.org/project/entity)\n- Disabled the core Search module\n- Optional: I downloaded and installed [Search API Pages](https://drupal.org/project/search_api_page). This isn't necessary, but you will need something to conduct the search. Per the [Search API developer](https://drupal.org/node/2051505): \"The Search API module doesn't replace the core search functionality, and without additional modules there is no way offered for actually searching. If you are using the Search API (no matter whether with Solr or with another backend) it is suggested to deactivate core's \"Search\" module, as the Search API is designed to completely replace it and doesn't integrate with it or use it in any way.\" In short, if you don't use an existing module in the Search API space, you will need to write your own.\n\nOther than that listed above, I did not add or change any modules/settings. Your situation is probably different, but it shouldn't matter at this point.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/1d32fbc-01_-_home_1.png\",\n        \"01 - home (1).png\",\n        1378,\n        874,\n        \"#3d85b4\"\n      ]\n    }\n  ]\n}\n[/block]\nMake sure you navigate to `admin/modules` and verify that the Search API Solr module and its related modules have been activated:\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/2ae4085-drupal_searchapi_images.png\",\n        \"drupal searchapi images.png\",\n        1134,\n        663,\n        \"#ecede5\"\n      ]\n    }\n  ]\n}\n[/block]\nMake sure to disable the core Search module:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ff3e817-02_-_modules2.png\",\n        \"02 - modules2.png\",\n        1117,\n        145,\n        \"#f2f2ea\"\n      ]\n    }\n  ]\n}\n[/block]\nYou will also need to make a slight modification to the Search API code. In the file `sites/all/modules/search_api_solr/includes/solr_connection.inc`, scroll down to line 328: `$response = $this->sendRawGet($url);` Basically, this part of the code pings websolr and asks for some administrative information. We protect the administrative interfaces for security reasons, so this fails. Frustratingly, users will receive a message about being unable to reach the Solr server... even while they can successfully index their documents. This problem can be fixed by changing this line to: `$response = (object) array('data' => '');`, which basically tells the module \"Yes! I reached the server, but I have nothing to report.\"\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/063d658-02_-_modules3.png\",\n        \"02 - modules3.png\",\n        710,\n        331,\n        \"#f9f9f9\"\n      ]\n    }\n  ]\n}\n[/block]\nThat's all you need to get started! Next, we'll configure the websolr index that will hold your documents.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Setting up the websolr index\"\n}\n[/block]\nNext, you'll want to [add a new slice](https://websolr.com/slices/new) to your websolr account. Give your index a descriptive name, select the server group nearest to your application, then select \"Drupal Search API Solr 7.x-1.1\":\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0c0a95d-03_-_d7-searchapi-create-index.png\",\n        \"03 - d7-searchapi-create-index.png\",\n        643,\n        358,\n        \"#dbeae9\"\n      ]\n    }\n  ]\n}\n[/block]\nWhen this form has been filled out, go ahead and click \"Create.\" Afterwards, you will be redirected to a page that shows the status of your index and will probably show a message about taking a few minutes to complete:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/cb48efa-08_-_d7-searchapi-configure-searchapi-2.png\",\n        \"08 - d7-searchapi-configure-searchapi-2.png\",\n        824,\n        606,\n        \"#6f5344\"\n      ]\n    }\n  ]\n}\n[/block]\nThis is usually finished within a few minutes, so take a short break. When you come back, hit refresh to see the following:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ae3b219-16_-_d7-searchapi-query-results.png\",\n        \"16 - d7-searchapi-query-results.png\",\n        1083,\n        666,\n        \"#331724\"\n      ]\n    }\n  ]\n}\n[/block]\nIf you see a message that says your index looks ok, you're done. Occasionally provisioning errors will occur and you will see a message about taking a long time to provision your index. Try appending \"/refreshing\" to the page's URL and give it a minute or two. If that doesn't clear things up, you will need to open a [support ticket](http://help.websolr.com) and have the Support Team take a closer look.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Setting up the Search API Solr Module\"\n}\n[/block]\nOnce your websolr index is up and running, it's time to configure the Search API Solr module. Navigate to `admin/config/search/search_api` and you should see something like this:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4cb1377-06_-_d7-searchapi-configure-searchapi.png\",\n        \"06 - d7-searchapi-configure-searchapi.png\",\n        1200,\n        235,\n        \"#1c2d37\"\n      ]\n    }\n  ]\n}\n[/block]\nThe first step to configuring Search API Solr is to tell the module about your websolr server. Click on the link marked \"Add Server\" and give your your server a helpful name and description. Select \"Solr service\" from the \"Service class\" dropdown and fill out the information as below (leave the \"Basic HTTP Authentication\" and \"Advanced\" fields alone):\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/6c54441-07_-_d7-searchapi-configure-searchapi-2.png\",\n        \"07 - d7-searchapi-configure-searchapi-2.png\",\n        876,\n        666,\n        \"#d7d8cf\"\n      ]\n    }\n  ]\n}\n[/block]\nClick \"Create server.\" If everything was input correctly, you should see something like this:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/019d7b7-08_-_d7-searchapi-configure-searchapi-2.png\",\n        \"08 - d7-searchapi-configure-searchapi-2.png\",\n        824,\n        606,\n        \"#6f5344\"\n      ]\n    }\n  ]\n}\n[/block]\nNow, return to `admin/config/search/search_api` We need to add a new index; we can do so by clicking on the \"Add index\" link and using the following information in the subsequent form:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0193dd3-09_-_d7-searchapi-configure-searchapi-3.png\",\n        \"09 - d7-searchapi-configure-searchapi-3.png\",\n        1154,\n        740,\n        \"#e6e6e1\"\n      ]\n    }\n  ]\n}\n[/block]\nKeep in mind that this tutorial is not going to cover all of the possible configurations. You will need to evaluate your needs and adapt the above settings as necessary. As it stands, this tutorial will involve indexing nodes only. Once you have saved the index, you should see something like this:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ecc4f4e-10_-_d7-searchapi-configure-searchapi-4.png\",\n        \"10 - d7-searchapi-configure-searchapi-4.png\",\n        1075,\n        546,\n        \"#eff1e9\"\n      ]\n    }\n  ]\n}\n[/block]\nAgain, we're not going to cover everything. Just enough to get our basic search up and running. I made the following selections to get the basic node elements indexed, but you will need to evaluate which fields are important for your specific application. Fortunately, if you make a mistake or want to change things later, you can do so:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/d74ba05-11_-_d7-searchapi-configure-searchapi-5.png\",\n        \"11 - d7-searchapi-configure-searchapi-5.png\",\n        1206,\n        798,\n        \"#f2f2ea\"\n      ]\n    }\n  ]\n}\n[/block]\nOnce you have configured your fields for the index, save your progress and you will see something like this:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/33e46a7-12_-_d7-searchapi-configure-searchapi-6.png\",\n        \"12 - d7-searchapi-configure-searchapi-6.png\",\n        720,\n        364,\n        \"#f4f5e7\"\n      ]\n    }\n  ]\n}\n[/block]\nYou don't strictly need to do anything with the workflow here. I didn't make any changes on the demo site, but feel free to make whatever tweaks are necessary for your app. You may want to save any of these changes for later though, AFTER you have successfully indexed and searched documents. That will help you narrow down your troubleshooting if necessary.\n\nNow, navigate back to `admin/config/search/search_api` and click on Edit > Status for the websolr index that you have created. You should see this:\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/50b604a-12_-_d7-searchapi-configure-searchapi-7.png\",\n        \"12 - d7-searchapi-configure-searchapi-7.png\",\n        1152,\n        511,\n        \"#d9d7d4\"\n      ]\n    }\n  ]\n}\n[/block]\nLeave the advanced settings alone and simply click on \"Index now.\" That will send all of your nodes to the new websolr index. You should get a neat little progress bar along the way. Once the indexing operation has completed, you should get a message like this:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/1308711-12_-_d7-searchapi-configure-searchapi-8.png\",\n        \"12 - d7-searchapi-configure-searchapi-8.png\",\n        625,\n        280,\n        \"#f6f8f2\"\n      ]\n    }\n  ]\n}\n[/block]\nIf you got any error messages, go back and check your settings. As a last step, I would recommend returning to `admin/config/search/search_api` and deleting the \"Default node index\" that came bundled with the module if you have not already done so. This is optional, but it will give a cleaner interface in my opinion.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Setting up the Search API Pages Module (optional)\"\n}\n[/block]\nThe Search API module does NOT provide any out of the box searching capabilities. Rather, it provides an API for other modules to simplify their own Solr searching. This means that you will either need to write your own module, tailored to your specific needs, or you will need to use an existing module. In this tutorial, I am using Search API Pages to provide a search page. This is optional for you, but it is a good tool to use at first because it will help you verify that everything is working.\n\nFrom `admin/config/search/search_api`, click on the \"Search Pages\" tab, then click on the \"Add search page\" link. Alternatively, you could simply navigate to `admin/config/search/search_api/page/add`. Fill out a form like this:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/1256b95-13_-_d7-searchapi-configure-searchapipages.png\",\n        \"13 - d7-searchapi-configure-searchapipages.png\",\n        754,\n        577,\n        \"#e0e4e2\"\n      ]\n    }\n  ]\n}\n[/block]\nOnce you have created the page, you will be able to customize how the query is processed and how the results are returned. You can pretty much just leave the defaults here:\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/092b13f-14_-_d7-searchapi-configure-searchapipages-2.png\",\n        \"14 - d7-searchapi-configure-searchapipages-2.png\",\n        688,\n        571,\n        \"#e1dfd8\"\n      ]\n    }\n  ]\n}\n[/block]\nClick on \"Create Page\" and you should get a message like this:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f158088-15_-_d7-searchapi-configure-searchapipages-3.png\",\n        \"15 - d7-searchapi-configure-searchapipages-3.png\",\n        1012,\n        222,\n        \"#edefe4\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Checking on your index\"\n}\n[/block]\nAfter the Search API Solr module has indicated a successful indexing of your documents, you can navigate to your websolr URL and append \"/select\" to it. For me, this was `http://ec2-west.websolr.com/solr/9ea6b15fcc9/select` This will return the first set of documents in your index. If you don't see them right away after indexing, don't worry. For reasons of network performance and stability, all websolr indices have a 60 second commit time. This means your documents can take up to 60 seconds to show up in your index; if you don't see them right away, just wait a minute, then hit refresh:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/78eb2e8-16_-_d7-searchapi-query-results.png\",\n        \"16 - d7-searchapi-query-results.png\",\n        1083,\n        666,\n        \"#331724\"\n      ]\n    }\n  ]\n}\n[/block]\nYou can also look at the slice summary, which will indicate the status of your index and how many documents are present:\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/19b0cb4-17_-_d7-searchapi-query-results-1.png\",\n        \"17 - d7-searchapi-query-results-1.png\",\n        642,\n        319,\n        \"#dbeae9\"\n      ]\n    }\n  ]\n}\n[/block]\nTo test Drupal, pick out a keyword that you can see in your index. Since my nodes were all randomly-generated, I grabbed the word \"dolor\" because it seemed to come up a few times. Go to your Drupal search (if you created a Search Page in the previous section, navigate there) and enter your chosen keyword. If everything is configured correctly, you should get a set of results:\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/eaa413c-18_-_d7-searchapi-query-results-2.png\",\n        \"18 - d7-searchapi-query-results-2.png\",\n        1024,\n        709,\n        \"#328fca\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Troubleshooting\"\n}\n[/block]\n### I get a 401 Unauthorized error when I try to index my documents ###\n\nYou have probably enabled authorization on this index. Making changes (writes, updates, deletes) to your index requires that your HMAC key be included in the request header. The Search API Solr module does not have the capability of crafting a request in this way. There are three solutions: disable advanced authorization, hack the module to include the HMAC header and hard-code your key, or write a patch for the module that adds this cabability for end users and submit it to the maintainer for consideration.","excerpt":"Learn how to set up a Websolr index to be used with Drupal 7 and the Search API Solr module.","slug":"drupal-7-with-the-search-api-solr-module","type":"basic","title":"Drupal 7 with the Search API Solr module"}

Drupal 7 with the Search API Solr module

Learn how to set up a Websolr index to be used with Drupal 7 and the Search API Solr module.

In this guide, we're going to cover the basics of setting up a websolr index to be used with [Drupal 7](https://drupal.org/drupal-7.22-release-notes) and the [Search API Solr](https://drupal.org/project/search_api_solr) module. A few points to note before we get started: - This example uses Drupal 7.22 and Search API Solr version 7.x-1.1. Your versions may vary; as long as the major versions are the same, you can reliably use this guide. - This guide is not meant to be an exhaustive tutorial on all of the things the Search API Solr module can do. The goal here is to get you up and running quickly, then let you tune things as necessary. - If you run into issues while following this guide, make sure to check the "Troubleshooting" section at the bottom and see if a soluton is addressed there. [block:api-header] { "type": "basic", "title": "Getting started" } [/block] For the purposes of this tutorial, I set up a vanilla Drupal 7 install. I used the Devel module to generate 50 nodes of random content so we would have something to index later. After my dummy content was created, I uninstalled and removed this module. I then prepped the site by: - Downloaded and extracted the following to `sites/all/modules`: [Search API](https://drupal.org/project/search_api), [Search API Solr](https://drupal.org/project/search_api_solr), [Entity](https://drupal.org/project/entity) - Disabled the core Search module - Optional: I downloaded and installed [Search API Pages](https://drupal.org/project/search_api_page). This isn't necessary, but you will need something to conduct the search. Per the [Search API developer](https://drupal.org/node/2051505): "The Search API module doesn't replace the core search functionality, and without additional modules there is no way offered for actually searching. If you are using the Search API (no matter whether with Solr or with another backend) it is suggested to deactivate core's "Search" module, as the Search API is designed to completely replace it and doesn't integrate with it or use it in any way." In short, if you don't use an existing module in the Search API space, you will need to write your own. Other than that listed above, I did not add or change any modules/settings. Your situation is probably different, but it shouldn't matter at this point. [block:image] { "images": [ { "image": [ "https://files.readme.io/1d32fbc-01_-_home_1.png", "01 - home (1).png", 1378, 874, "#3d85b4" ] } ] } [/block] Make sure you navigate to `admin/modules` and verify that the Search API Solr module and its related modules have been activated: [block:image] { "images": [ { "image": [ "https://files.readme.io/2ae4085-drupal_searchapi_images.png", "drupal searchapi images.png", 1134, 663, "#ecede5" ] } ] } [/block] Make sure to disable the core Search module: [block:image] { "images": [ { "image": [ "https://files.readme.io/ff3e817-02_-_modules2.png", "02 - modules2.png", 1117, 145, "#f2f2ea" ] } ] } [/block] You will also need to make a slight modification to the Search API code. In the file `sites/all/modules/search_api_solr/includes/solr_connection.inc`, scroll down to line 328: `$response = $this->sendRawGet($url);` Basically, this part of the code pings websolr and asks for some administrative information. We protect the administrative interfaces for security reasons, so this fails. Frustratingly, users will receive a message about being unable to reach the Solr server... even while they can successfully index their documents. This problem can be fixed by changing this line to: `$response = (object) array('data' => '');`, which basically tells the module "Yes! I reached the server, but I have nothing to report." [block:image] { "images": [ { "image": [ "https://files.readme.io/063d658-02_-_modules3.png", "02 - modules3.png", 710, 331, "#f9f9f9" ] } ] } [/block] That's all you need to get started! Next, we'll configure the websolr index that will hold your documents. [block:api-header] { "type": "basic", "title": "Setting up the websolr index" } [/block] Next, you'll want to [add a new slice](https://websolr.com/slices/new) to your websolr account. Give your index a descriptive name, select the server group nearest to your application, then select "Drupal Search API Solr 7.x-1.1": [block:image] { "images": [ { "image": [ "https://files.readme.io/0c0a95d-03_-_d7-searchapi-create-index.png", "03 - d7-searchapi-create-index.png", 643, 358, "#dbeae9" ] } ] } [/block] When this form has been filled out, go ahead and click "Create." Afterwards, you will be redirected to a page that shows the status of your index and will probably show a message about taking a few minutes to complete: [block:image] { "images": [ { "image": [ "https://files.readme.io/cb48efa-08_-_d7-searchapi-configure-searchapi-2.png", "08 - d7-searchapi-configure-searchapi-2.png", 824, 606, "#6f5344" ] } ] } [/block] This is usually finished within a few minutes, so take a short break. When you come back, hit refresh to see the following: [block:image] { "images": [ { "image": [ "https://files.readme.io/ae3b219-16_-_d7-searchapi-query-results.png", "16 - d7-searchapi-query-results.png", 1083, 666, "#331724" ] } ] } [/block] If you see a message that says your index looks ok, you're done. Occasionally provisioning errors will occur and you will see a message about taking a long time to provision your index. Try appending "/refreshing" to the page's URL and give it a minute or two. If that doesn't clear things up, you will need to open a [support ticket](http://help.websolr.com) and have the Support Team take a closer look. [block:api-header] { "type": "basic", "title": "Setting up the Search API Solr Module" } [/block] Once your websolr index is up and running, it's time to configure the Search API Solr module. Navigate to `admin/config/search/search_api` and you should see something like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/4cb1377-06_-_d7-searchapi-configure-searchapi.png", "06 - d7-searchapi-configure-searchapi.png", 1200, 235, "#1c2d37" ] } ] } [/block] The first step to configuring Search API Solr is to tell the module about your websolr server. Click on the link marked "Add Server" and give your your server a helpful name and description. Select "Solr service" from the "Service class" dropdown and fill out the information as below (leave the "Basic HTTP Authentication" and "Advanced" fields alone): [block:image] { "images": [ { "image": [ "https://files.readme.io/6c54441-07_-_d7-searchapi-configure-searchapi-2.png", "07 - d7-searchapi-configure-searchapi-2.png", 876, 666, "#d7d8cf" ] } ] } [/block] Click "Create server." If everything was input correctly, you should see something like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/019d7b7-08_-_d7-searchapi-configure-searchapi-2.png", "08 - d7-searchapi-configure-searchapi-2.png", 824, 606, "#6f5344" ] } ] } [/block] Now, return to `admin/config/search/search_api` We need to add a new index; we can do so by clicking on the "Add index" link and using the following information in the subsequent form: [block:image] { "images": [ { "image": [ "https://files.readme.io/0193dd3-09_-_d7-searchapi-configure-searchapi-3.png", "09 - d7-searchapi-configure-searchapi-3.png", 1154, 740, "#e6e6e1" ] } ] } [/block] Keep in mind that this tutorial is not going to cover all of the possible configurations. You will need to evaluate your needs and adapt the above settings as necessary. As it stands, this tutorial will involve indexing nodes only. Once you have saved the index, you should see something like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/ecc4f4e-10_-_d7-searchapi-configure-searchapi-4.png", "10 - d7-searchapi-configure-searchapi-4.png", 1075, 546, "#eff1e9" ] } ] } [/block] Again, we're not going to cover everything. Just enough to get our basic search up and running. I made the following selections to get the basic node elements indexed, but you will need to evaluate which fields are important for your specific application. Fortunately, if you make a mistake or want to change things later, you can do so: [block:image] { "images": [ { "image": [ "https://files.readme.io/d74ba05-11_-_d7-searchapi-configure-searchapi-5.png", "11 - d7-searchapi-configure-searchapi-5.png", 1206, 798, "#f2f2ea" ] } ] } [/block] Once you have configured your fields for the index, save your progress and you will see something like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/33e46a7-12_-_d7-searchapi-configure-searchapi-6.png", "12 - d7-searchapi-configure-searchapi-6.png", 720, 364, "#f4f5e7" ] } ] } [/block] You don't strictly need to do anything with the workflow here. I didn't make any changes on the demo site, but feel free to make whatever tweaks are necessary for your app. You may want to save any of these changes for later though, AFTER you have successfully indexed and searched documents. That will help you narrow down your troubleshooting if necessary. Now, navigate back to `admin/config/search/search_api` and click on Edit > Status for the websolr index that you have created. You should see this: [block:image] { "images": [ { "image": [ "https://files.readme.io/50b604a-12_-_d7-searchapi-configure-searchapi-7.png", "12 - d7-searchapi-configure-searchapi-7.png", 1152, 511, "#d9d7d4" ] } ] } [/block] Leave the advanced settings alone and simply click on "Index now." That will send all of your nodes to the new websolr index. You should get a neat little progress bar along the way. Once the indexing operation has completed, you should get a message like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/1308711-12_-_d7-searchapi-configure-searchapi-8.png", "12 - d7-searchapi-configure-searchapi-8.png", 625, 280, "#f6f8f2" ] } ] } [/block] If you got any error messages, go back and check your settings. As a last step, I would recommend returning to `admin/config/search/search_api` and deleting the "Default node index" that came bundled with the module if you have not already done so. This is optional, but it will give a cleaner interface in my opinion. [block:api-header] { "type": "basic", "title": "Setting up the Search API Pages Module (optional)" } [/block] The Search API module does NOT provide any out of the box searching capabilities. Rather, it provides an API for other modules to simplify their own Solr searching. This means that you will either need to write your own module, tailored to your specific needs, or you will need to use an existing module. In this tutorial, I am using Search API Pages to provide a search page. This is optional for you, but it is a good tool to use at first because it will help you verify that everything is working. From `admin/config/search/search_api`, click on the "Search Pages" tab, then click on the "Add search page" link. Alternatively, you could simply navigate to `admin/config/search/search_api/page/add`. Fill out a form like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/1256b95-13_-_d7-searchapi-configure-searchapipages.png", "13 - d7-searchapi-configure-searchapipages.png", 754, 577, "#e0e4e2" ] } ] } [/block] Once you have created the page, you will be able to customize how the query is processed and how the results are returned. You can pretty much just leave the defaults here: [block:image] { "images": [ { "image": [ "https://files.readme.io/092b13f-14_-_d7-searchapi-configure-searchapipages-2.png", "14 - d7-searchapi-configure-searchapipages-2.png", 688, 571, "#e1dfd8" ] } ] } [/block] Click on "Create Page" and you should get a message like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/f158088-15_-_d7-searchapi-configure-searchapipages-3.png", "15 - d7-searchapi-configure-searchapipages-3.png", 1012, 222, "#edefe4" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Checking on your index" } [/block] After the Search API Solr module has indicated a successful indexing of your documents, you can navigate to your websolr URL and append "/select" to it. For me, this was `http://ec2-west.websolr.com/solr/9ea6b15fcc9/select` This will return the first set of documents in your index. If you don't see them right away after indexing, don't worry. For reasons of network performance and stability, all websolr indices have a 60 second commit time. This means your documents can take up to 60 seconds to show up in your index; if you don't see them right away, just wait a minute, then hit refresh: [block:image] { "images": [ { "image": [ "https://files.readme.io/78eb2e8-16_-_d7-searchapi-query-results.png", "16 - d7-searchapi-query-results.png", 1083, 666, "#331724" ] } ] } [/block] You can also look at the slice summary, which will indicate the status of your index and how many documents are present: [block:image] { "images": [ { "image": [ "https://files.readme.io/19b0cb4-17_-_d7-searchapi-query-results-1.png", "17 - d7-searchapi-query-results-1.png", 642, 319, "#dbeae9" ] } ] } [/block] To test Drupal, pick out a keyword that you can see in your index. Since my nodes were all randomly-generated, I grabbed the word "dolor" because it seemed to come up a few times. Go to your Drupal search (if you created a Search Page in the previous section, navigate there) and enter your chosen keyword. If everything is configured correctly, you should get a set of results: [block:image] { "images": [ { "image": [ "https://files.readme.io/eaa413c-18_-_d7-searchapi-query-results-2.png", "18 - d7-searchapi-query-results-2.png", 1024, 709, "#328fca" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Troubleshooting" } [/block] ### I get a 401 Unauthorized error when I try to index my documents ### You have probably enabled authorization on this index. Making changes (writes, updates, deletes) to your index requires that your HMAC key be included in the request header. The Search API Solr module does not have the capability of crafting a request in this way. There are three solutions: disable advanced authorization, hack the module to include the HMAC header and hard-code your key, or write a patch for the module that adds this cabability for end users and submit it to the maintainer for consideration.