简体   繁体   中英

solr filter query range

in my index i have a multivalued doc field named "counter". it stores values like counter:[5, 12, 75, ...] and so on.

if i try to retrieve only docs where the min value of this field is greater than another value i cant get the expected result. i tried with the following filter query:

field(counter, min)\:[10 TO *]

this is the field type used and the field declaration in schema.xml:

<fieldType name="integer" class="solr.TrieIntField" omitNorms="true"/>           

<field name="counter" type="integer" indexed="true" stored="true" docValues="true" multiValued="true"/>

there are no errors but not the expected result, unfortunately. thanks in advance.

You can use the frange query parser to retrieve documents that match a range of values returned by a function:

fq={!frange l=10}field(counter,min)

The FunctionRangeQParser extends the QParserPlugin and creates a range query over a function. This is also referred to as frange, as seen in the examples below.

Other parameters:

l , The lower bound, optional

u , The upper bound, optional

incl , Include the lower bound: true/false, optional, default=true

incu , Include the upper bound: true/false, optional, default=true

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