Fieldweights - Architecture and mechanism

Valid from Datafari X.X

The fields weight are stored in the solrconfig.xml file of the FileShare core.

The admin UI proposed in Datafari communicates with the FieldWeight servlet, which in turn:

  • reads the schema and solrconfig files,

  • modifes the solrconfig.

When you go on the UI, it immediately sends a request towards the servlet to get the fields that are appended to the select.

Selecting a field will acquire a semaphore to prevent people from reading or writing a value that you are about to change.

Note that there are two types of query with their own weight for each fields, so there is one semaphore per type, since you will not have to modify the same line in the file.

Once you selected a file, you will get its current weight (0 if not weighted). Confirming your modifications will send the request and release the semaphore. Due to the particular structure of the lines involved, this functionnality has its dedicated servlet, but if you want to modify the content of a node, you can use the ModifyNodeContent servlet.

ModifyNodeContent

It is a servlet that opens solrconfig.xml and looks for a node with a specified attribute. For instance, assuming there is a node with parameter "name" equal to "threshold", and we want to set the node value to 0.01:

This is done by applying the following parameters:

  • <float name="threshold">0.005</float>

    This line will then become :

  • <float name="threshold">0.01</float>

This servlet is currently used by the size Limitation UI, and by the autocomplete configuration UI. This allows to prevent two or more users from modifying the same value. This servlet creates a semaphore on the doGet. The semaphore is based on the value of the attribute: in our previous example, “threshold", someone can modify the size limitation and someone else can modify the threshold of the autocomplete.