0

Based on information I found in this SO answer:

Update specific field on SOLR index

as of Solr 4.0, updating specific fields of a Solr document is possible via its HTTP API.

Looking on the PHP Solr PECL extension page here:

http://pecl.php.net/package/solr

seems to imply that Solr 4.0 feature support has been added. I looked through the documentation for the extension here:

http://www.php.net/manual/en/book.solr.php

and in particular the documentation for addDocument here:

http://www.php.net/manual/en/solrclient.adddocument.php

but it does not seem to indicate whether or not "overwriting" a document means deleting it and then adding the current document, or updating fields individually. There does not appear to be any methods specifically meant to update fields either.

Does anyone know if the extension has the capability of updating field values without deleting the document?

Cœur
  • 37,241
  • 25
  • 195
  • 267
thatidiotguy
  • 8,701
  • 13
  • 60
  • 105

1 Answers1

1

There is nothing in the changelog indicating that the php_solr extension supports updating single fields (field updates has a few requirements for your schema as well). I'd say that it hasn't been a priority, as it's not much different from just submitting the document again (which your toolchain should be able to do).

overwrite replaces allowDupsand two other settings related to the XML update messages in Solr4.0, but is not related to field level updates - just what action you want to take when the uniqueKey already exists in the index.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • Unfortunately there are definitely use cases where updating individual fields is much better than replacing the entire document. If parts of the document are extremely expensive to put together, but you want to change one other simple field, you will be forced to run the expensive operation again to rebuild the document. Thank you for the answer though. – thatidiotguy Jun 26 '14 at 14:24
  • In that case you probably want to keep the field available anyway, but yes, I see that argument. For Solr it's the same, however - since it will have to retrieve the raw values for each field to resubmit the document with the new field value. – MatsLindh Jun 27 '14 at 10:04