Blog: Solr

Internationalization Support for ApacheSolr in Drupal
Programmer

Drill Down Faceted Searches Based on Language

Drill Down Faceted Searches Based on Language

Sometimes it's easy to forget that less than half the web is in English. However, when managing large sites in multiple languages, it's good to be constantly aware of what language you're working with. That's why we wrote internationalization support for the ApacheSolr search module.

You can see how it works in this screencast.

With the new patches and a slight change to the search index schema, ApacheSolr will store the languages you choose with the i18n module. Then you can enable the Language Filter block to perform faceted searches based on language - to drill down to those that you speak or read.

Adding this and other extensions to ApacheSolr is possible because Solr itself uses a flexible schema to store document data. Adding an indexed language field was as simple as appending

   <field name="language" type="string" indexed="true" stored="true"/>

to the site's schema.xml file. This flexibility also allowed for a few other tweaks to the search engine, so stay tuned.

You can download the new patches and be sure to make the change specified to your schema.xml file.

Solr: An Alternative to Drupal Search, Now with Group Filtering
Programmer

Module Lets Users Search Content Based on Access Privileges

Module Lets Users Search Content Based on Access Privileges

David Goode is a new addition to Development Seed and to the Drupal community. He'll be working with us this summer until he goes off to college in the fall. I think we'll be able to make him a full Drupal convert by then : )

One module that has frequently been put forward as a candidate for improvement in Drupal is the search module. Two reasons for this are its ranking system, which can be less than ideal, and its tendency to bog sites down and slow load times since it indexes and searches on the same SQL database that the site uses for all other operations. However, there is another option that's available to Drupal users: Solr. Running on its own Java daemon, Solr is a well-established, fast, and powerful indexing and search implementation accessed over HTTP. What it isn't is fully integrated with Drupal - yet.

There is a module - apachesolr - that's being actively developed that presently supports using Solr for searching Drupal sites. However, because Solr's search is independent of the usual SQL queries used by Drupal - and immune to the performance ramifications therein - the module doesn't currently support the node access permissions system, and therefore returns blurbs of what could be restricted content. This extends to organic groups, where all content is returned in the search results even if the user is not a member of the associated group.

Happily, we have just finished a module that implements basic group access privileges for Drupal search with Solr. Running as a secure filtering layer between the apachesolr module and the user, it instructs Solr to index and internally filter its returns by group. Users can either receive results from a single group to which they are subscribed, which is useful for specific searching within a larger site, or view returns from all their subscribed groups as well as non-grouped content.