- The system submits all the content from its data base that a user may search for into Solr for indexing.
- When a user performs search the system asks Solr to do the actual search and return IDs of matched content.
- The system then fetches objects from its data base using returned IDs.
Solr schema supporting different objects
Every object submitted to Solr has a unique prefix defining object type. This prefix is appended to Solr ID and every field specific to the object. Different objects with the same IDs and overlapping filed names will have distinct names in Solr index.
Submitting content into Solr
When the system changes an object it will re-submit its fresh copy into Solr.
There are several tasks for wiping out existing content and then re-submitting. Such tasks executed manually and exist as last resort when Solr schema changes. Each task is dedicated for specific object type (eg. labels).
Solr may be disabled through settings. After the migration to Solr obsolete database search queries were deprecated and removed leaving Solr as the only search option available. Disabling it will stop searching and the system will not trigger updates of altered objects. Because Solr is external application it is automatically disabled for unit testing.
When to use Solr?
- User triggered queries to boost the performance.
Do not use Solr
- Internal queries which the system uses to fetch and update. Such queries already optimized and do not have any proprietary filters.
- Objects which changing very frequently and not exposed to a user (eg. settings). The system updates Solr on every change causing overhead, plus stale data may be returned by Solr.
Configuration Solr 3.5 (JBoss / Tomcat)
- Solr is deployed as an external WAR file (multi core) with Solr home path hard coded in its web.xml (this is changed manually by editing the file and repacking the WAR).
- Solr schema is configured in its home path (inside a core).
- Solr URL has no security layer, so a Valve should be added to JBoss server.xml restricting any IP accessing local host (except for 127.0.0.1).
- The system connects to the proper Solr core by using the SolrURL setting.
- See external resources for:
- Configuring logging via Log4j.
- Enabling UTF-8 queries.
Configuration Solr 5 (standalone)
- Solr is deployed as a stanalone server.
- The rest of the steps are similar to Solr 3.5 described above.
- Solr WIKI http://wiki.apache.org
- Solr with JBoss http://wiki.apache.org/solr/SolrJBoss#Solr_with_JBoss
- Enabling UTF-8 queries http://wiki.apache.org/solr/SolrTomcat