complex query with solrnet

287 views Asked by At

How can I build complex queries like this solr query with solrnet.

q=*:* & fq=(Code1:("N02" +OR+ "N01") +OR+ Code2:"B0") 
  +OR+ (*:* AND -Flg:G) +OR+ Id:"\-30"*

I want to use filter queries

  1. with logical operations combined with expression

    ex: all cars ((red or green) or automatic)

  2. with not operation

    ex: all cars except white ones

  3. with wild card

    ex: all cars with make starting 'mit'

  4. with parameters which need to be escaped

    ex: all cars with id starting with '-30'

1

There are 1 answers

1
Prafful Nagpal On

with logical operations combined with expression

ex: all cars ((red or green) or automatic)

Ans: car_color:( red OR green ) OR car_transmission:( automatic )

with not operation

ex: all cars except white ones

Ans : -car_color:( white ) - is spl char used to donate not in solr query

with wild card

ex: all cars with make starting 'mit'

Ans: car_make:mit* * is a wild char represents 0 or more

with parameters which need to be escaped

ex: all cars with id starting with '-30'

Ans: car_id:( -30* ) - is a spl char in solr so it needs to escaped using \ char