is there possibility to update a new field to an existing document? For example: There is an document with several fields, e.g.
ID=99999
Field1:text
Field2:text
This document is already in the index, now I want to insert a new field to this document WITHOUT the old data:
ID=99999
Field3:text
For now, the old document will be deleted and a new document with the ID will be created. So if I now search for the ID 99999 the result will be:
ID=99999
Field3:text
I read this at the Solr Wiki
How can I update a specific field of an existing document?
I want update a specific field in a document, is that possible? I only need to index one field for >a specific document. Do I have to index all the document for this?
No, just the one document. Let's say you have a CMS and you edit one document. You will need to re-index this document only by using the the add solr statement for the whole document (not one field only).
In Lucene to update a document the operation is really a delete followed by an add. You will need >to add the complete document as there is no such "update only a field" semantics in Lucene.
So is there any solution for this? Will this function be implemented in a further version (I currently use 3.6.0). As a workaround, I thought about writing a script or an application, which will collect the existing fields, add the new field and update the whole document. But I think this will suffer performance. Do you have any other ideas?
Best regards
Update all fields in a documentPress F9. If your document has tables with fields or formulas, you might need to select each table separately and press F9. Tip: To make sure that you don't forget to update your table of contents before you print the document, set Word to update fields automatically before printing.
To add field or fields to embedded documents (including documents in arrays) use the dot notation. See example. To add an element to an existing array field with $addFields , use with $concatArrays .
Select the document you want to edit by clicking the document name. On the Document Details page, click EDIT / UPDATE. You can see this button at the top right corner of the page only if you have Document Edit Permission. On the Edit Document page, make your changes.
Updating fields To update a field manually, right-click the field and then click Update Field or press F9. To update all fields manually in the main body of a document, press Ctrl + A to select all and then press F9. Some fields in headers, footers or text boxes must be updated separately.
There is no effective difference between updating fields and insert new fields from the document side. You'll have to configure the field by using the schema api or schema. xml, if not running in schemaless mode (so unless you're prototyping, add the field first). The atomic update support is the way to go.
Some fields, such as page numbers, will automatically update when you preview your document. Many fields are set by default to update when you open a document but you can also set an option in Microsoft Word to update fields when you preview your file.
From Solr 4 onwards you can update a field in solr ....no need to reindex the entire indexes .... various modifiers are supported like ....
set – set or replace a particular value, or remove the value if null is specified as the new value add – adds an additional value to a list remove – removes a value (or a list of values) from a list removeregex – removes from a list that match the given Java regular expression inc – increments a numeric value by a specific amount (use a negative value to decrement)
example :
document
{
"id": "1",
"name" : "Solr"
"views" : "2"
}
now update with
$ curl http://localhost:8983/solr/demo/update -d '
[
{"id" : "1",
"author" : {"set":"Neal Stephenson"},
"views" : {"inc":3},
}
]'
will result into
{
"id": "1",
"name" : "Solr"
"views" : "5"
"author" : "Neal Stephenson"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With