Skip to content

Instantly share code, notes, and snippets.

@zpalexander
Created December 19, 2014 09:53
Show Gist options
  • Save zpalexander/b1df3eb1ff650b539750 to your computer and use it in GitHub Desktop.
Save zpalexander/b1df3eb1ff650b539750 to your computer and use it in GitHub Desktop.
# Search API Notes
[Project on drupal.org](https://www.drupal.org/project/search_api):
>This module provides a framework for easily creating searches on any entity known to Drupal, using any kind of search engine. For site administrators, it is a great alternative to other search solutions, since it already incorporates facetting support and the ability to use the Views module for displaying search results, filters, etc. Also, with the Apache Solr integration, a high-performance search engine is available for this module.
>Developers, on the other hand, will be impressed by the large flexibility and numerous ways of extension the module provides. Hence, the growing number of additional contrib modules, providing additional functionality or helping users customize some aspects of the search process.
### Use
***Basic:***
1. Go to `Configuration -> Search API` and create a server (name, description, service class)
2. Go to `Configuration -> Search API` and create an index (choose what to index and attach it to a server, add data-alter callbacks, processors)
3. Choose which fields to index
4. Run the indexer to index all pre-existing content
5. Go to `Structure -> Views` and create a search page (choose name, description, index, path)
***Notes:***
- When using a 3rd party search server (like Apache SOLR, choose a different 'Service Class' when creating the server in step 1)
- For basic alterations to the search page, use the *Display Suite Search* sub-module that ships with [Display Suite](http://drupal.org/project/ds)
- For more advanced custom search pages, create your own custom page with [Views](http://drupal.org/project/views)
- For advanced back-end search implementations (such as in our UI project), the Search API module integrates with Apache SOLR via the [Search API Solr Search module](https://www.drupal.org/project/search_api_solr)
### Resources
- [Official project documentation](https://www.drupal.org/node/1250878)
- [Screencast on module usage from the developer](http://vimeo.com/15556855)
- [How to Create Basic Search Pages Tutorial](http://webwash.net/tutorials/intro-search-api-part-1-how-create-search-pages)
- [How to integrate Views with Search API](https://www.drupal.org/node/1597930)
- [How to integrate Search API with Apache SOLR](https://www.drupal.org/node/1999310)
------------------------
# Facet API Notes
[From wikipedia](http://en.wikipedia.org/wiki/Faceted_search):
>Faceted search, also called faceted navigation or faceted browsing, is a technique for accessing information organized according to a faceted classification system, allowing users to explore a collection of information by applying multiple filters. A faceted classification system classifies each information element along multiple explicit dimensions, called facets, enabling the classifications to be accessed and ordered in multiple ways rather than in a single, pre-determined, taxonomic order.
[Project on drupal.org](https://www.drupal.org/project/facetapi):
>The Facet API module allows site builders to easily create and manage faceted search interfaces. In addition to the UI components that come out of the box, themers and module developers can build their own widgets... Facet API works with the core Search, Search API, and Apache Solr Search Integration modules (including Acquia Search) meaning that code and configuration can be reused as-is with the most popular search solutions available to Drupal.
### Use
***Basic:***
1. Go to `Configuration -> Search API` and click on the edit link within the "Article index" and select "Facets" from the dropdown
2. Select the desired facets and save - this creates a block that you can place anywhere on the site`
3. Go to the piece of the site that you are using to create your search results page (`Views`, `DisplaySuite` or plain old `Blocks`) and add the block to the desired region
***Notes:***
- The *Facet API* module ships with a useful block called the "Current Search Block". This block displays information about the current search that can be useful to users.
- The *[Facet API Pretty Paths](https://www.drupal.org/project/facetapi_pretty_paths)* module is helpful for keeping URLs looking clean
### Resources
- [Official project documentation](http://www.trellon.com/content/blog/apachesolr-and-facetapi)
- [Basic text tutorial on use](webwash.net/tutorials/intro-search-api-part-2-faceted-search)
- [Basic video tutorial on use](https://www.youtube.com/watch?v=XlAyDvtR-V4)
- [Video on using Faceted search with Apache SOLR](https://www.youtube.com/watch?v=2XEMkXCS5u8)
- [Drupalcon talk](https://www.youtube.com/watch?v=rArRwp_1h8Q)
- [Example of facets working well ('Filter by Category' on the right side)](http://www.photoshare.org/images/search/grid/health)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment