On 12/8/22 02:43, Eduardo Gomez wrote:
I have seen there have been some changes introduced to how child docs are
updated (
https://solr.apache.org/guide/8_0/major-changes-in-solr-8.html#nested-documents).
From the docs:
*" ... an attempt to update a child document by providing a new document
with the same ID would add a new document (which will probably be
erroneous)"*
I'm not using nested docs, however I'm observing exactly that happening in
Solr 8.11.1 for all my docs. It seems like the only way of avoiding that is
adding this to the schema:
At first it wasn't clear to me what the problem you're having actually
is. Then I glanced back at the message subject ... it is the only place
you mention it.
I have never used the parent/child document feature myself. But from
things other people have said, the main issue with updating a child
document is that in order for a parent/child document relationship to
work, all documents must be in the same Lucene segment. So you can't
just update a child document, you have to update all the children and
all the parents at the same time, so the new documents are all in the
same segment. But if you are not using that functionality it's not
really something you need to worry about.
I do have the _root_ field definition in my schema. Not because I am
using nested documents, but because Solr complained that the field was
missing. I never put anything in that field. I just got a look at it,
and it has indexed, stored, and docValues as false. Which basically
means that it's not possible to actually use the field. That's fine for
my use case, where there are no nested documents. It has been a really
long time since I created this schema ... I was probably trying to
eliminate the log message without actually making my index larger.
What is the full definition of your uniqueKey field? Looking for both
the field definition as well as the referenced fieldType definition.
There are gotchas if you try to use a TextField type field as a
uniqueKey field. You would want to use a StrField or one of the numeric
types for uniqueKey.
This is my uniqueKey field definition:
<field name="id" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
<uniqueKey>id</uniqueKey>
<fieldType name="string" class="solr.StrField" sortMissingLast="true"
docValues="true" />
Do you have uniqueKey defined? If you don't, Solr has no way of knowing
that a new document should replace an existing document. Certain other
functionalities will not work at all without a uniqueKey.
There is also a setting that basically stops Solr from deleting an
existing document when you index a new one with the same value in the
uniqueKey field. I forget what that is and where you might find it.
Can you share the full core config and exactly what you are sending to
Solr for indexing, including any URL parameters that you are using?
Lucene, the technology underlying most of Solr's functionality, does not
have the concept of a uniqueKey. That is something solr implemented on
top of Lucene.
Thanks,
Shawn