c# - How to perform atomic update of a document in Solr with HttpWebRequest -


i want update existing record in solr httpwebrequest. i'm using solr 4.3.0 , don't want use libraries solrnet. want prepare data in solr, , perform query against application (that use solrnet) test if prepared data returned when queried.

i'm having 2 problems.

firstly, when performing atomic update query, solr complains required fields missing. don't want supply fields except uniqueid , field being updated, possible?

secondly, seems if do supply required fields, solr creates new document. leads me suspect uniquekey not working should.

unique key is:

<field name="objectguid" type="string" indexed="true" stored="true" required="true" multivalued="false"/> 

set so:

 <uniquekey>objectguid</uniquekey> 

i have 2 documents in solr index, both same objectguid...

any appreciated.

edit: thank replies far.

1, 2 example update document:

<add>     <doc>         <field name="objectguid">33176f43-b446-481b-84e9-3facf4d71717</field>          <field name="mydate" update="set">2013-07-14t08:25:09z</field>      </doc> </add> 

3 thank pointing out caveats. fields in schema have stored="true" except following two:

furthermore, <dynamicfield> nodes have stored="false"

are these 2 cases possible causes problems?

(also, can't find occurrence of distributedupdaterequestprocessorfactory in solrconfig.xml. if i'm reading caveats correctly, if haven't added modifiers aspect, behavior default , shouldn't prevent atomic updates.)

lastly think there might problems case sensitivity in guid fields.. i've noticed before. use datahandler import data database, , guids uppercase in database. i've noticed (when using solrnet) guids returned lowercase, need supplied solr uppercase... has else seen behavior , if so, there way avoid this?

the problem related upper/lowercase:

solr return objectguid in uppercase , expects in uppercase. however, when using solrnet or guid.parse in c#.net, default guid transformed lowercase.

if lowercase guid used, doesn't match existing document in solr, , new record created. furthermore, because solr trying create new record, required fields must supplied, explains both problems having.


Comments