2
votes

I'm trying to add a full-text search feature to project. I don't want to store the full content of all documents, so I decided to use stored="false" for "content" field. Also, there is a boolean field to indicate that a document is deleted or not. When I create a new document in Solr it works great. But when I update is_deleted field - the "content" is appeared to be lost from the index and I can't search this document any more.

I have found a post that says that fields don't need to be stored when In-Place update, but it doesn't work for me.

Some details:

Schema:

<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="_version_" type="plong" indexed="false" stored="false" docValues="true"/>
<field name="is_deleted" type="boolean" indexed="false" stored="false" docValues="true"/>
<field name="content" type="text_general" indexed="true" stored="false" multiValued="true"/>

Adding a test document using "/update" handler:

{
"id": "doc1",
"is_deleted": false,
"content": "SEARCH ME"
}

Update document:

{
"id": "doc1",
"is_deleted": {"set": true}
}

Using Solr v 7.5.0.

Solr In-Place update documentation doesn't say anything about the need to store all field for this type of update.

1
Do you have any copyField instructions? If so, they'll also have to conform to the requirements of inplace updates for it to take place.MatsLindh

1 Answers

0
votes

I found a solution. It was my mistake - I considered boolean field as numerical. So that's why In-Place update didn't work for me (because Solr did a common atomic update).

Since I have changed is_deleted field from boolean to int everything works correctly and I don't lose data from content while updating is_deleted anymore.

So the answer is: Solr doesn't need to store all field when using In-Place update.

Thanks to EricLavault for mention field type requirement. It helped a lot)