0

Morning everybody ,, this is my first time to use solr after reading some document about q , and fq i want to make query that return all rows that have last digit equal 3 for example .

I tried to use regex like condition id:/.*3/ , but this return no data .

Now i want to do this using mod function , Please explain your solution .

Thanks for help.

1 Answers1

0

You don't need a regular expression to do that, q=id:*3 works right out of the box.

You can apply a function query to your field using the {!frange} parser, which will return any document where the result of the function behind it returns a value within the range defined.

q={!frange l=0 u=0}mod(id, 3)

.. assuming that id is an integer. This will only give you values where the function evaluates as 0, as both the upper and lower bounds are 0 (and by default, the lower/upper is included in the range).

MatsLindh
  • 49,529
  • 4
  • 53
  • 84