You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Phil Scadden <P....@gns.cri.nz> on 2017/09/25 21:42:02 UTC

DocValues, Long and SolrJ

I ran into a problem with indexing documents which I worked around by changing data type, but I am curious as to how the setup could be made to work.

Solr 6.5.1 - Field type Long, multivalued false, DocValues.

In indexing with Solr, I set the value of field with:
                Long accessLevel
                                ...
                accessLevel = qury.val(1);
                                ...
                Document.addField("access", accessLevel);

Solr fails to add the document with this message:

"cannot change DocValues type from SORTED_SET to NUMERIC for field"

??? So how do you configure a single-valued Long type?
Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.

RE: DocValues, Long and SolrJ

Posted by Phil Scadden <P....@gns.cri.nz>.
The delete for additions is done with:

       ConcurrentUpdateSolrClient solr = new ConcurrentUpdateSolrClient(solrProperties.getServer(),10,2);
       try {
            solr.deleteByQuery("*:*");
            solr.commit();
       } catch (SolrServerException | IOException ex) {
....
       }

// start the index rebuild

-----Original Message-----
From: Phil Scadden [mailto:P.Scadden@gns.cri.nz]
Sent: Wednesday, 27 September 2017 10:04 a.m.
To: solr-user@lucene.apache.org
Subject: RE: DocValues, Long and SolrJ

I get it after I have deleted the index with a delete query and start trying to populate it again with new documents. The error occurs when the indexer tries to add a new document. And yes, I did change the schema before I started the operation.

-----Original Message-----
From: Emir Arnautović [mailto:emir.arnautovic@sematext.com]
Sent: Tuesday, 26 September 2017 8:49 p.m.
To: solr-user@lucene.apache.org
Subject: Re: DocValues, Long and SolrJ

Hi Phil,
Are you saying that you get this error when you create fresh core/collection? This sort of errors are usually related to schema being changed after some documents being indexed.

Thanks,
Emir

> On 25 Sep 2017, at 23:42, Phil Scadden <P....@gns.cri.nz> wrote:
>
> I ran into a problem with indexing documents which I worked around by changing data type, but I am curious as to how the setup could be made to work.
>
> Solr 6.5.1 - Field type Long, multivalued false, DocValues.
>
> In indexing with Solr, I set the value of field with:
>                Long accessLevel
>                                ...
>                accessLevel = qury.val(1);
>                                ...
>                Document.addField("access", accessLevel);
>
> Solr fails to add the document with this message:
>
> "cannot change DocValues type from SORTED_SET to NUMERIC for field"
>
> ??? So how do you configure a single-valued Long type?
> Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.

Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.
Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.

Re: DocValues, Long and SolrJ

Posted by Emir Arnautović <em...@sematext.com>.
I did not look at the code, but after deleting make sure all segments are gone (maybe optimize), make sure you reloaded the core and if nothing works (and this is the recommended solution) recreate your collection instead of deleting all documents. 

HTH,
Emir

> On 26 Sep 2017, at 23:04, Phil Scadden <P....@gns.cri.nz> wrote:
> 
> I get it after I have deleted the index with a delete query and start trying to populate it again with new documents. The error occurs when the indexer tries to add a new document. And yes, I did change the schema before I started the operation.
> 
> -----Original Message-----
> From: Emir Arnautović [mailto:emir.arnautovic@sematext.com]
> Sent: Tuesday, 26 September 2017 8:49 p.m.
> To: solr-user@lucene.apache.org
> Subject: Re: DocValues, Long and SolrJ
> 
> Hi Phil,
> Are you saying that you get this error when you create fresh core/collection? This sort of errors are usually related to schema being changed after some documents being indexed.
> 
> Thanks,
> Emir
> 
>> On 25 Sep 2017, at 23:42, Phil Scadden <P....@gns.cri.nz> wrote:
>> 
>> I ran into a problem with indexing documents which I worked around by changing data type, but I am curious as to how the setup could be made to work.
>> 
>> Solr 6.5.1 - Field type Long, multivalued false, DocValues.
>> 
>> In indexing with Solr, I set the value of field with:
>>               Long accessLevel
>>                               ...
>>               accessLevel = qury.val(1);
>>                               ...
>>               Document.addField("access", accessLevel);
>> 
>> Solr fails to add the document with this message:
>> 
>> "cannot change DocValues type from SORTED_SET to NUMERIC for field"
>> 
>> ??? So how do you configure a single-valued Long type?
>> Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.
> 
> Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.


RE: DocValues, Long and SolrJ

Posted by Phil Scadden <P....@gns.cri.nz>.
I get it after I have deleted the index with a delete query and start trying to populate it again with new documents. The error occurs when the indexer tries to add a new document. And yes, I did change the schema before I started the operation.

-----Original Message-----
From: Emir Arnautović [mailto:emir.arnautovic@sematext.com]
Sent: Tuesday, 26 September 2017 8:49 p.m.
To: solr-user@lucene.apache.org
Subject: Re: DocValues, Long and SolrJ

Hi Phil,
Are you saying that you get this error when you create fresh core/collection? This sort of errors are usually related to schema being changed after some documents being indexed.

Thanks,
Emir

> On 25 Sep 2017, at 23:42, Phil Scadden <P....@gns.cri.nz> wrote:
>
> I ran into a problem with indexing documents which I worked around by changing data type, but I am curious as to how the setup could be made to work.
>
> Solr 6.5.1 - Field type Long, multivalued false, DocValues.
>
> In indexing with Solr, I set the value of field with:
>                Long accessLevel
>                                ...
>                accessLevel = qury.val(1);
>                                ...
>                Document.addField("access", accessLevel);
>
> Solr fails to add the document with this message:
>
> "cannot change DocValues type from SORTED_SET to NUMERIC for field"
>
> ??? So how do you configure a single-valued Long type?
> Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.

Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.

Re: DocValues, Long and SolrJ

Posted by Emir Arnautović <em...@sematext.com>.
Hi Phil,
Are you saying that you get this error when you create fresh core/collection? This sort of errors are usually related to schema being changed after some documents being indexed.

Thanks,
Emir

> On 25 Sep 2017, at 23:42, Phil Scadden <P....@gns.cri.nz> wrote:
> 
> I ran into a problem with indexing documents which I worked around by changing data type, but I am curious as to how the setup could be made to work.
> 
> Solr 6.5.1 - Field type Long, multivalued false, DocValues.
> 
> In indexing with Solr, I set the value of field with:
>                Long accessLevel
>                                ...
>                accessLevel = qury.val(1);
>                                ...
>                Document.addField("access", accessLevel);
> 
> Solr fails to add the document with this message:
> 
> "cannot change DocValues type from SORTED_SET to NUMERIC for field"
> 
> ??? So how do you configure a single-valued Long type?
> Notice: This email and any attachments are confidential and may not be used, published or redistributed without the prior written consent of the Institute of Geological and Nuclear Sciences Limited (GNS Science). If received in error please destroy and immediately notify GNS Science. Do not copy or disclose the contents.