Schema.xml
==========

For those interested, this section explains some of the modifications made to the schema.xml file that is included with the plugin. The information in this section is not required in order to implement the plugin, but may prove useful in any further customization efforts.

The schema.xml file that I've included is pretty basic, so you may want to modify it to better fit your needs. The relevant points are as follows:

You'll notice in the field definitions towards the end of the file, there are a couple of attributes "indexed" and "stored." In most acts_as_solr schema.xml files, "indexed" is always set to true and "stored" is always false. The reason for this is that acts_as_solr assumes that every field you index is for search purposes only, as it only allows the engine to return the primary key field. What I've done to the file is to define a few more dynamic fields (to limit your need to interact with the file). By default, both attributes will now be set to true, so, out of the box, anything you index will be available for search and will be returned with the results. This may not be ideal for you, though, because it could unnecessarily inflate the Solr files. To prevent this, I've defined 2 additional dynamic fields for each one that was previously defined. In other words, where before there was a "*_t" field (t = text), now, there are also "*_st" (st = stored text) and "*_it" (it = indexed text).

Example:
<dynamicField name="*_t" type="text" indexed="true" stored="true"/>
<dynamicField name="*_st" type="text" indexed="false" stored="true"/>
<dynamicField name="*_it" type="text" indexed="true" stored="false"/>

You can, of course, go into this schema file and define individual fields and their attributes. The "*_t" wildcard is there to simplify things and minimize the developer's need to interact with the file (this part of the file is unchanged from the one acts_as_solr provides).

One other aspect of this file that's worth noting is that it defines a default search field (text) and copies all text (*_t) and facet (*_facet) fields into that field. This is what allows you to run a simple query without having to specify fields to be searched.

Example:
<defaultSearchField>text</defaultSearchField>

<copyField source="*_t" dest="text"/>
<copyField source="*_facet" dest="text"/>