13.05.2014 Views

apache-solr-ref-guide-4.6.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Besides the name and the class, which are common to all field types, this type also takes two additional parameters:<br />

enumsConfig: the name of a configuration file that contains the list of field values and their order. This file can include several different<br />

lists of field values if there are multiple uses for this field type in your Solr implementation.<br />

enumName: the name of the list in the configuration file to use for this type.<br />

Defining the EnumField configuration file<br />

The file named with the enumsConfig parameter in the field type definition should contain name:value pairs, where name is the field value and<br />

value is a number indicating the sort order. Higher "value" numbers will sort before lower "value" numbers. If a path to the file is not defined in<br />

the field type, the file should be in the conf directory for the collection.<br />

In this example, there are two value lists defined. Each list is between enum opening and closing tags:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Working with External Files and Processes<br />

The<br />

ExternalFileField Type<br />

The ExternalFileField type makes it possible to specify the values for a field in a file outside the Solr index. For such a field, the file contains<br />

mappings from a key field to the field value. Another way to think of this is that, instead of specifying the field in documents as they are indexed,<br />

Solr finds values for this field in the external file.<br />

External fields are not searchable. They can be used only for function queries or display. For more information on function<br />

queries, see the section on Function Queries.<br />

The ExternalFileField type is handy for cases where you want to update a particular field in many documents more often than you want to<br />

update the rest of the documents. For example, suppose you have implemented a document rank based on the number of views. You might want<br />

to update the rank of all the documents daily or hourly, while the rest of the contents of the documents might be updated much less frequently.<br />

Without ExternalFileField, you would need to update each document just to change the rank. Using ExternalFileField is much more<br />

efficient because all document values for a particular field are stored in an external file that can be updated as frequently as you wish.<br />

In schema.xml, the definition of this field type might look like this:<br />

<br />

Apache Solr Reference Guide 4.6<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!