Developer forum

Forum » Ecommerce - Standard features » Query parameter value between two indexed integer values

Query parameter value between two indexed integer values

Bjarne Rosendal
Bjarne Rosendal
Reply

I have a product index where I have two fields of type integer with data looking like this:

How can I setup a query that looks into the index for documents with a value between the NZdimensionmin1 and the NZdimensionmax1 fields range using one parameter - say the value 780 in this example?


Replies

 
Nicolai Pedersen
Reply

Should be fairly simple:

  1. Create one parameter - i.e. "dimension"
  2. Create a group in queries, set tit to be an "And" type
  3. Add 2 conditionals:
    1. NZdimensionmin1 GreaterThan "dimension"
    2. NZdimensionmax1 LessThan "dimension"

That should be it.

BR Nicolai

 
Bjarne Rosendal
Bjarne Rosendal
Reply

Hi Nicolai

Yeah, one should think it would be easy! :)
The solution you suggest was the first thing I tried out, but it gives me zero results. I have setup the search here:
https://lhi-staging.nozebrahosting.dk/produkter/fleksible-overgange/-koblinger?dimension=780
I have attached the products.query file used on the page. Dimension parameter on line 46 and query group starting on line 400. Looks ok, right?

/ Bjarne

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Bjarne, old friend :)

Have you tried to switch the GreaterThan/LessThan around?

Instead of this:

DimensionMinimum1 GreaterThan dimension
DimensionMaximum1 LessThan dimension

Try this:

DimensionMinimum1 LessThan dimension
DimensionMaximum1 GreaterThan dimension

Also, you have some values in those fields that are not valid integers (text and decimal numbers). That might be a problem. I'm not sure.

Best regards,
Morten

Votes for this answer: 1
 
Bjarne Rosendal
Bjarne Rosendal
Reply

Hi Morten

Once again you have saved the day! It totally works by switching the operators around. How it's working I cannot get my head around, but that's fine by me :D

Thanks alot!

 

You must be logged in to post in the forum