Here is one possible way to rework your schema. Hope this gives you some idea.
I am going to assume that the prices per quantity is in multiples of 50 below for all your products. Else you will need to reduce your intervals.
Define a dynamic field called price_upto_*
like this:
<dynamicField name="price_upto_*" type="integer" indexed="true" stored="true"/>
Then you can index your docs with fields like this:
price_upto_50: 1,
price_upto_100: 2,
price_upto_150: 3,
price_upto_200: 4
Here is how you will write your client code for the queries. Below use integer division (meaning (20/50) = 0, (60/50) = 1, etc.,)
Query: if i search for quantity 20, then above result should display.
In your client, you need to do calculate: 50 * (1 + (20/50)) = 50 * (1 + 0) = 50. So the field you are searching for is price_upto_50
. Your query will be like q=price_upto_50:[* TO *]
.
Query: if i search for price 1, then above result should display.
q=price_upto_50:1 OR price_upto_100:1 OR price_upto_150:1 OR price_upto_200:1
As you can see, this can become ugly if you have prices for every interval of 50. So you can use a copy field as suggested here and copy all your price fields into that one field and issue a search like:
q=price_upto_static:1
Query: if i search for price 3 and quantity 60 then above result should not display.
q=price_upto_100:3
(Your doc won't match.)