Using the OSF SearchAPI Module

Introduction
The Drupal SearchAPI is a module that is used to create a search engine for a Drupal website. OSF for Drupal does re-implement the general SearchAPI to be able to communicate with the Search web service endpoint.

It is also possible to use the search server to index the local content into an OSF instance. However, since this is not the preferred way to save local Drupal content type entities into OSF, we are not discussing any of these features in this manual page. All the local content data should be saved into the CCR using the OSF FieldStorage.

Configuring the search engine server
The first step is to configure the search engine. Even if we consider that the search server is already configured, we will see what are these configurations and how they can eventually be modified.

To access the configuration pages of the search engine, you have to click on the top  menu item. Then you have to search an click on the  link. Then you will get to the list of all the configure SearchAPI  and. If you installed OSF for Drupal using the OSF Installer tool, then you should see appearing the  server and the   index.

First, let's edit the  server by clicking the   link for that line item. There is one major feature other than the server's name: the OSF Service's endpoint. In the  options list, you have the list of all the registered OSF Web Services endpoints on that Drupal instance. What you have to do is to select the one you want to use where to send the Search queries.

Once you selected the OSF Web Services endpoint to use, you only have to click.

Configuring the search page
Once the search server is properly configured, the next step is to configure the search page. The search page is the URL where the search engine will be accessible to the users. By going to that URL, the users will be able to use the search engine we are configuring.

To access the search pages, you have to click the  tab when you are looking at the list of available servers and indexes. This will redirect you to the list of available search pages. If you installed OSF for Drupal using the OSF Installer tool, you should see a search page that has  as the path. Then if we want to edit that path, we have to click the  link. The setting we are interested in in this page is the. The path is the URL path where the search engine page will be accessible. If the search page is configured like this, it means that the search engine page will be available to the users that goes to this URL:



Configuring search facets
Once the search server and the search page are properly configured, one thing that the administrators may want to do is to configure a series of search facets blocks that would be available to the users to facet the information they are searching for.

To configure the facets, you have to click the  link for the index. Then click the  link that will appear. You will then get redirected to the page that list all the available facets to the users (there can be quite a few). All the properties that are used in any available dataset may become a facet in the search engine. In this example, we selected the  and the   facets.

Once you selected all the facets you want to expose, you have to click the  button.

What happen when you click that button is that a Block will be created for each facet you selected. The next step is to configure the facet blocks that you created by selecting the facets to expose. What you have to do is to go to the list of all blocks, and then search for the  blocks. These are the blocks that have been created by the previous step. All the facets will be displayed in these blocks. By default, these blocks are disabled. The next step is to position the blocks in the layout of your theme. Once you positioned them, you have to click to save the configuration of the blocks before configuring the blocks individually. The last step is to configure the blocks. Beside the positioning of the blocks, the main configuration options for these facets blocks are the. There are the settings you will be using to determine where (which page) and who will have access to these facets blocks.

Using the search engine
Once everything is properly configured, you can good to you lookup page to start searching for content that comes from your OSF instance. There are three major areas in a search page: If you enter a search keyword in the search box, then all the results will appear below that search box and the facets blocks will appears where they got positioned. Each of the facets that have been exposed will be populated with a series of values that could be used to filter the content of the search resultset. The number of records in each facet is displayed in parenthesis.

It is also possible to theme the results that are returned. Check the Theming OSF SearchAPI results section for more information. If you click on one of the facet, you will be redirected to a new search page where the facet as been applied. The number of results should go down after the facet is applied to the search query. More than one facet can be applied to a single search query. Search facets can be removed by clicking the  link.