[ 
https://issues.apache.org/jira/browse/SOLR-17449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17887771#comment-17887771
 ] 

Seunghan Jung commented on SOLR-17449:
--------------------------------------

This is an example where the error I mentioned occurs.

I indexed the bbox field and a general text field (text_en) as follows:
{code:java}
{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":0,
    "params":{
      "q":"*:*",
      "indent":"true",
      "q.op":"OR",
      "useParams":"",
      "_":"1728450525945"
    }
  },
  "response":{
    "numFound":1,
    "start":0,
    "numFoundExact":true,
    "docs":[{
      "id":"1",
      "text_en":"This is bbox field bug example",
      "bbox":"ENVELOPE(-10, 10, 20, -20)",
      "bbox__maxX":10.0,
      "_version_":1812411633878695936,
      "bbox__maxY":20.0,
      "bbox__minX":-10.0,
      "bbox__minY":-20.0
    }]
  }
} {code}
The schema status is as follows:
{code:java}
<fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>
<fieldType name="bbox" class="solr.BBoxField" geo="true" numberType="pdouble" 
distanceUnits="kilometers"/>
<field name="bbox" type="bbox" indexed="true" stored="true"/>{code}
 

To preserve the bbox field value during an atomic update, stored="true" is 
required.

 

At this point, I try an atomic update on text_en as follows:
{code:java}
{
  "id": "1",
  "text_en": {"set": "Error happens!"}
}{code}
 

However, the following error occurs, and the atomic update fails:
{code:java}
Exception writing document id 1 to the index; possible analysis error: 
DocValuesField "bbox__maxX" appears more than once in this document (only one 
value is allowed per field){code}

> bboxField subfield Error in atomic updating
> -------------------------------------------
>
>                 Key: SOLR-17449
>                 URL: https://issues.apache.org/jira/browse/SOLR-17449
>             Project: Solr
>          Issue Type: Bug
>          Components: Schema and Analysis
>    Affects Versions: main (10.0)
>            Reporter: Seunghan Jung
>            Priority: Minor
>         Attachments: image-2024-09-13-17-45-17-161.png
>
>
> For fields of type `bboxField`, derived fields such as `minX`, `maxX`, 
> `minY`, `maxY`, etc., are added to the schema and indexed.
> However, this causes issues during atomic updates. During an atomic update, 
> when a new document is moved and indexed, the fields of type `bboxField` are 
> re-indexed with `minX`, `maxX`, `minY`, `maxY` just as they were initially. 
> Since the original document already contains these fields, they are indexed 
> again in the new document. However, because they are already indexed by the 
> `bbox` field, this results in duplicate indexing. If the `numberType` 
> attribute of the bbox field type has `docValues=true`, an error occurs due to 
> the docValues being written twice.
> Here is the error message for this case:
> {code:java}
> Caused by: java.lang.IllegalArgumentException: DocValuesField "bbox__maxX" 
> appears more than once in this document (only one value is allowed per field)
>         at 
> org.apache.lucene.index.NumericDocValuesWriter.addValue(NumericDocValuesWriter.java:53)
>  ~[?:?]
>         at 
> org.apache.lucene.index.IndexingChain.indexDocValue(IndexingChain.java:937) 
> ~[?:?]
>         at 
> org.apache.lucene.index.IndexingChain.processField(IndexingChain.java:723) 
> ~[?:?]
>         at 
> org.apache.lucene.index.IndexingChain.processDocument(IndexingChain.java:576) 
> ~[?:?]
>         at 
> org.apache.lucene.index.DocumentsWriterPerThread.updateDocuments(DocumentsWriterPerThread.java:242)
>  ~[?:?]
>         at 
> org.apache.lucene.index.DocumentsWriter.updateDocuments(DocumentsWriter.java:432)
>  ~[?:?]
>         at 
> org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1545) 
> ~[?:?]
>         at 
> org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1521) 
> ~[?:?]
>         at 
> org.apache.solr.update.DirectUpdateHandler2.updateDocOrDocValues(DirectUpdateHandler2.java:1062)
>  ~[?:?]
>         at 
> org.apache.solr.update.DirectUpdateHandler2.doNormalUpdate(DirectUpdateHandler2.java:421)
>  ~[?:?]
>         at 
> org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:374)
>  ~[?:?]
>         at 
> org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:311)
>  ~[?:?]{code}
>  
> Of course, setting the docValues="false" for the field type used in 
> numberType resolves the issue.
> However, this is not explained in the[ Solr Reference 
> Guide|https://solr.apache.org/guide/solr/latest/query-guide/spatial-search.html#bboxfield].
>  Instead, the example schema shows docValues="true", which makes it seem like 
> this is how it should be configured.
> !image-2024-09-13-17-45-17-161.png|width=1037,height=233!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to