O'Reilly logo

Apache Solr 4 Cookbook by Rafal Kuc'

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating a single field of your document

Imagine that you have a system where you store a document your users upload. In addition to that, your users can add other users to have access to the files they uploaded. As you probably know, before Solr 4.0, when you wanted to update a single field in a document you had to re-index the whole document. Solr 4.0 allows you to update a single field if you fulfill some basic requirements. So let's see how we can do that in Solr 4.0.

How to do it...

For the purpose of the recipe, let's assume we have the following index structure (put the following entries to your schema.xml file's fields section):

<field name="id" type="string" indexed="true" stored="true" required="true" /> <field name="file" type="text_general" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required