As you probably know, the RichDocumentRequestHandler (SOLR-284) will
index documents from a few different formats. You specify the document
body in the HTTP POST request stream, the name of the Solr field where
you wish to store the document body in the URL, and you can also
specify (again in the URL) field name/field value pairs for other
fields you want to be indexed along with the body.

What I just noticed is that one particular field name, "id", gets
special treatment, and I'm wondering if it actually needs special
treatment.

Currently, the handler requires a field named "id", and requires that
it be an integer. The ID field is a special case when fields are being
added to the document builder; the general case code looks like this:

  for (int i =0; i < fields.length;i++){
    String fieldName = fields[i].getName();
    String[] values = params.getParams(fieldName);
    for(String value : values) {
        builder.addField(fieldName,value,1.0f);
    }
  }

while the ID-specific code looks like this:

  builder.addField("id", id + "", 1.0f);

Outside of this field-adding code, though, the id field doesn't seem
to be treated differently from any other field. I'm guessing that the
id parameter is meant provide a unique key for the document you're
indexing. Is there any reason to hard-code the name of that field,
though, or to require it to be an integer? Maybe I would like to call
my unique key field "key", for instance, and have its datatype be
text.

Hopefully I am being coherent.

Chris

Reply via email to