I'm using Solr and I would like to add a field last_update
in the schema.xml
where the default value would be the current date when the document is added or updated.
Do you have an idea how can I do this?
Thanks
A field type defines the analysis that will occur on a field when documents are indexed or queries are sent to the index. A field type definition can include four types of information: The name of the field type (mandatory). An implementation class name (mandatory).
Dynamic fields allow Solr to index fields that you did not explicitly define in your schema. This is useful if you discover you have forgotten to define one or more fields. Dynamic fields can make your application less brittle by providing some flexibility in the documents you can add to Solr.
It is a supported scenario for DateField. The following should work:
<field name="last_update" type="date" indexed="true" stored="true" default="NOW" />
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