2

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.

2
  • 1
    How about fq={!frange l=10}field(counter,min)? Using a function query directly as a field name in a query don't work as far as I know. Commented Sep 12, 2018 at 18:48
  • hi, sorry about the delay and thank you very much for your help Commented Sep 24, 2018 at 7:20

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.