basic question about updating a docValue

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

basic question about updating a docValue

Jerry Lin
Hi,

I'm new to Solr and am using Solr 8, and the Java API client. I have a
score that I would like to rank my documents by, and I do not need to
retrieve the values. My understanding is that I should set indexed="true",
stored="false", and DocValues="true". When I manually set up the schema in
that way (with type plong), and I add a document by supplying an int, I get:

Exception writing document ... to the index; possible analysis error:
cannot change DocValues type from SORTED_NUMERIC to NUMERIC for field

If I don't DocValues=false, the document update works fine. What should I
do to resolve this error?

Thank you,
Jerry
Reply | Threaded
Open this post in threaded view
|

Re: basic question about updating a docValue

Alexandre Rafalovitch
Sounds like you had some documents in the index already from before you
made ths change. You may need to delete, commit, reindex. Rather than
trying to overwrite.

Regards,
     Alex

On Tue, May 7, 2019, 1:03 AM Jerry Lin, <[hidden email]> wrote:

> Hi,
>
> I'm new to Solr and am using Solr 8, and the Java API client. I have a
> score that I would like to rank my documents by, and I do not need to
> retrieve the values. My understanding is that I should set indexed="true",
> stored="false", and DocValues="true". When I manually set up the schema in
> that way (with type plong), and I add a document by supplying an int, I
> get:
>
> Exception writing document ... to the index; possible analysis error:
> cannot change DocValues type from SORTED_NUMERIC to NUMERIC for field
>
> If I don't DocValues=false, the document update works fine. What should I
> do to resolve this error?
>
> Thank you,
> Jerry
>
Reply | Threaded
Open this post in threaded view
|

Re: basic question about updating a docValue

Shawn Heisey-2
In reply to this post by Jerry Lin
On 5/6/2019 11:03 PM, Jerry Lin wrote:
> I'm new to Solr and am using Solr 8, and the Java API client. I have a
> score that I would like to rank my documents by, and I do not need to
> retrieve the values. My understanding is that I should set indexed="true",
> stored="false", and DocValues="true". When I manually set up the schema in
> that way (with type plong), and I add a document by supplying an int, I get:

The field must be 'indexed="false"' as well for in-place updates to
work.  If you have indexed set to true, I don't think that's going to
work.  Here's the relevant documentation section:

https://lucene.apache.org/solr/guide/7_7/updating-parts-of-documents.html#in-place-updates

Thanks,
Shawn
Reply | Threaded
Open this post in threaded view
|

Re: basic question about updating a docValue

Shawn Heisey-2
On 5/7/2019 7:35 AM, Shawn Heisey wrote:
> The field must be 'indexed="false"' as well for in-place updates to
> work.  If you have indexed set to true, I don't think that's going to
> work.  Here's the relevant documentation section:

My answer was not meant to contradict the one you got earlier from
Alexandre.

If you already had data in your index for that field and you changed the
definition, Lucene's DocValues functionality will very often complain.
The only way to fix that problem, as Alexandre said, is to completely
delete the index directory, reload the index or restart Solr, and build
it again.

Thanks,
Shawn
Reply | Threaded
Open this post in threaded view
|

Re: basic question about updating a docValue

Jerry Lin-2
Hello,

Thank you for your responses. In the end, my program now works, but I had
trouble even when I had 0 documents because I did not restart Solr until I
read Shawn's comment.

Thanks!
Jerry


On Tue, May 7, 2019 at 6:41 AM Shawn Heisey <[hidden email]> wrote:

> On 5/7/2019 7:35 AM, Shawn Heisey wrote:
> > The field must be 'indexed="false"' as well for in-place updates to
> > work.  If you have indexed set to true, I don't think that's going to
> > work.  Here's the relevant documentation section:
>
> My answer was not meant to contradict the one you got earlier from
> Alexandre.
>
> If you already had data in your index for that field and you changed the
> definition, Lucene's DocValues functionality will very often complain.
> The only way to fix that problem, as Alexandre said, is to completely
> delete the index directory, reload the index or restart Solr, and build
> it again.
>
> Thanks,
> Shawn
>