简体   繁体   中英

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

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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM