Solr external files

The ExternalFileField type enables a specified field value to come from an external file other than the Solr index. For this specified field, the file contains the mapping relationship between the key field and the filed value. From another point of view, solr gets the value from the external file, not the index.
Note: This external field cannot be indexed into
This ExternalFileField type is useful for frequently updating a field that is referenced by multiple documents. Suppose you have a completed document, sorted numerically. It is possible that you want to update the sort rank on a daily or hourly basis, while the rest of the document is rarely updated. Without ExternalFileField, only the per-document sorting level can be updated. However, using ExternalFileField is more efficient, because all document-specific fields are stored in the same external file, maintaining a many-to-one relationship, so that you can change one place to get the desired effect.
 
For example: In managed-schema, the field type is defined as follows:
<fieldType name="entryRankFile" keyField="pkId" defVal="0" stored="false" indexed="false" class="solr.ExternalFileField" valType="pfloat"/>
 
The keyField attribute defines the key value in the external file. In the index, a unique value is often used to identify a document, but keyFiedl is generally not used as a unique identifier to identify a document in the index. If there is no corresponding external document, defVal can be used as the default value,
 
  • External file formatting:
External files are placed in Solr's index directory, by default in $SOLR_HOME/data. The file name should be in the form of external_fieldname or external_fieldname.*, for example: file naming method: external_entryRankFile or external_entryRankFile.txt.
  • Reload external files
An event listener can be defined to load an external file when a searcher is loaded or a new searcher is started.
A simple definition is as follows:
<listener event="newSearcher" class="org.apache.solr.schema.ExternalFileFieldReloader"/>
<listener event="firstSearcher" class="org.apache.solr.schema.ExternalFileFieldReloader"/>
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327041101&siteId=291194637