Here is what I found out:

The CSVRequestHandler gets its fields in line 240 and the following
ones. Those fieldnames come from the file's header
or from the specified params in the request.

The CSVRequestHandler calls prepareFields to create an array of
SchemaFields (see line 269) that will be
filled by schema-fields in line 282.
Here comes the problem: "MyID" does not exist as a schemaField, which
throws an Exception.
Ignoring the field "MyID" would not solve the problem, since it is
needed for my UpdateRequestProcessor.

Well, this does not seem to me like a bug but more like an exotic
situation where two concepts collidate with eachother.
The CSVRequestHandler is intended to sweep all the unneccessary stuff
out of the input to avoid exceptions for unknown fields
while my UpdateRequestProcessor needs such fields to work correctly.

I could imagine to add all expected fields to my schema.xmll with
indexed + stored = false, but this is dirty.
However, the more I think of a rewrite for my situation, the less sense
it makes since the validation is definitly neccessary.

It seems like I will end up in my first idea with adding all expected
fields to my schema.xml, if there are no other suggestions.

Thank you for your help!

Regards

Am 31.01.2011 16:58, schrieb Em:
> Okay, I added some Logging-Stuff to both the processor and its factory.
> It turned out that there IS an updateProcessor returned and it is NOT null.
> However, my logging-method inside the processAdd-Method (1st line, so it
> HAS to be called, if one calls the method) get never called - so the
> exception will definitly get called before my processor does something.
>
> Looking into the CSVRequestHandler shows that the CSVRequestHandler's
> prepareFields()-method seems to be based on the header of the CSV-file,
> not on the document itself. However, I am currently reading more of the
> code to understand what really happens, because everything works fine,
> if the fields of the csv are specified - no matter whether I add fields
> with an UpdateRequestProcessor or not.
>
> If you like, have a look around line 282 (prepareFields) in
> CSVRequestHandler.
>
> Regards
>
> Am 31.01.2011 16:06, schrieb Koji Sekiguchi:
>> (11/01/31 23:33), Em wrote:
>>> Hi Koji,
>>>
>>> following is the solrconfig:
>>>
>>>      <requestHandler name="/update/csv" class="solr.CSVRequestHandler">
>>>          <lst name="defaults">
>>>              <str name="update.processor">throwAway</str>
>>>          </lst>
>>>      </requestHandler>
>>>
>>>    <updateRequestProcessorChain name="throwAway">
>>>          <processor
>>> class="solr.experiments.solr.update.processor.ThrowAwayUpdateProcessorFactory"/>
>>>
>>>          <processor class="solr.RunUpdateProcessorFactory" />
>>>    </updateRequestProcessorChain>
>>>
>>> Do you see any mistake here?
>>>
>>> Regards
>>>
>> Hmm, Looks fine. Are you sure you create your update processor instance
>> in your factory and return it? (if it is null, processor chain simply
>> ignores your processor...)
>>
>> Koji
>

Reply via email to