root
root

Reputation: 3937

how to use docvalues in solr

I am trying to put docvalues on some of the fields which we use a lot for sorting. In order to avoid the fieldCache and rather use the doc values on disk i am using something like following in the schema.xml

<field indexed="true" multiValued="false" name="date" docValues="true" stored="true" omitNorms="true" omitPositions="true" termVectors="false" termPositions="false" termOffsets="false" type="TrieDateField"/>

I wanted to know that is that enough for using the forward index rather then fieldCache while sorting on this field, or do i have to send something like

q:date:[NOW/HOUR-1HOUR TO NOW/HOUR]&fieldCache:false

in each query also while doing sorting on this field.

I am using Datastax 5.0

Upvotes: 0

Views: 986

Answers (1)

Pavel Vasilev
Pavel Vasilev

Reputation: 1042

Apparently that should be enough. As per official Solr documentation on docValues:

To use docValues, you only need to enable it for a field that you will use it with.

Also please pay attention to:

If you have already indexed data into your Solr index, you will need to completely re-index your content after changing your field definitions in schema.xml in order to successfully use docValues.

Btw, I would also like to ensure your schema.xml is 100% clear: ... type="TrieDateField". I'm under assumption that it should be rather ... type="date" (date is predefined fieldType with implementation of solr.TrieDateField).

Upvotes: 2

Related Questions