Forums / Setup & design / Use of the Range Option class attribute - searching within ranges

Use of the Range Option class attribute - searching within ranges

Author Message

steve walker

Friday 23 July 2004 3:38:27 am

Hi there,

I have to setup a advanced search facility that allows users to search within ranges, in my case for electronic components - so they may wish to find all capacitors with a voltage range that encomapasses 50mV etc...

I was hoping to use the 'Range Option' attribute when building the class - when users then search on a particluar field, does the search return results within the range, or am I misunderstanding this attribute.

Some clarification on this would be great - I see being able to search on ranges is being developed at http://www.ez.no/community/news/workshop_notes but I'm hoping this doesnt refer to the already existing 'Range Option'.

Thanks, Steve.

http://www.oneworldmarket.co.uk

steve walker

Monday 26 July 2004 12:56:59 am

Morning!

Anyone out there got any info on this?

Thanks, Steve.

http://www.oneworldmarket.co.uk

steve walker

Monday 26 July 2004 11:44:10 am

Hello! Hoping to make contact with another human at some point ;)

Unfortunately we have a client who *has* to have an advance search facility that searches between ranges - so whether this is a future implementation from the Ez crew or not, I unfortunately have to bite the bullet and get this working :((((

Anyway, from what I can make out the range option is no good to me? Given it doesn't have an 'make searchable' option when constructing the class I guess it must be designed for something else?

So that takes me to constructing an advanced search tpl that will go to a class, take VAR1min and VAR1max and see if the searched value lies in between the two...

I would be very happy to develop this as a contribution and will post the resultant tpl into that area, but I'll need some colaboration, or another (better scripting) brain that can give me some some guidance.

Does the Ez crew have any beta advanced search stuff like this I could use?

All thoughts and ideas would be highly appreciated.

Thanks, Steve.

http://www.oneworldmarket.co.uk

Sergiy Pushchin

Tuesday 27 July 2004 6:30:02 am

I think there is way to achive what you want. but it works for integre values. I mean for example you have a contentclass which has ezinteger attribute voltage.. And you want to find all objects of this class which has voltage attribute from 0 to 50.
you need to setup special template for advanced search.
in this template you need to setup some variables.
You must have inside it:

<form action={"/content/advancedsearch/"|ezurl} method="get">
<input type="hidden" name="Content_search_attribute_byrange_classattribute_id[]" value="[your classattribute_id]" />
<input type="text"  name="Content_search_attribute_byrange_from[]" value="">
<input type="text"  name="Content_search_attribute_byrange_to[]" value="">
<input class="button" type="submit" name="SearchButton" value="Search" />
</form>

I think that would help you.

steve walker

Tuesday 27 July 2004 8:34:08 am

Sergiy,

Thankyou for your reply.

I've taken a look at the integer datatype, and unfortunately I dont think it will do what I'm after - it allows you to specifiy a max and min in the class attribute - and this stops some entering a value outside of that range when they input data into that field.

I need to create a advanced search function that:

- allows a user to search on a particular field within the class, lets say for our example temperature (T).

- in the class I would specify 2 attributes: Tmin and Tmax

- on my advanced search page there would be a field that allows you to search on Temperature only. You put a T value in the form, and it goes and looks at the data pertainintg to T only.

- the advanced search needs to have hardcoded into it: if form field for temperature is filled out, take a (say product) class; if the search criteria is greater than Tmin and is less than Tmax return a result.

I would have thought the solution lies in developing the fetch so that it grabs the two values and compares for values falling inbetween the two?

Regards, Steve.

http://www.oneworldmarket.co.uk

Lazaro Ferreira

Sunday 24 October 2004 3:25:21 am

Hi Steve,

We need something similar, have you develop something ?

Our ideas about it, are similar to yours , We have developed a new fecth function (already an ezpublish extension) to support the advanced search within attributes with ranges of values

On the other hand, we have created some content clasess that uses some select attributes to store the ranges id only, then we have store the actual range values as arrays of settings in .ini files, to extract the range information properly, we are going to develop some custom tpl operators that should return the max, and min values for ezp tpl variables, we can also use the php classes behind the operators to deal with the max and min (ranges) values in php directly (i.e: cron processing etc)

What do you think all about ?

Our doubt right now, is missing built-in ezp features to deal better with this

Thanks

Lazaro
http://www.mzbusiness.com

Lazaro Ferreira

Sunday 24 October 2004 4:21:34 am

Hi,

Sorry, I said a custom operator above, it is actually a custom function for fetch operator

Lazaro
http://www.mzbusiness.com

steve walker

Monday 01 November 2004 4:25:09 am

Lazaro,

Apologies for not replying to you on this - we moved offices about 2 months ago. In Spain the install time for adsl is a month, and since the installation a month ago the provider still hasnt managed to get our connection work properly... so at the moment I'm using dialup and am waiting for Telefonica to install a new service as i cant wait for the other idiots to sort themselves out.

Its been a trying month to say the least :(((

Anyway, I havent been able to be very active on the forums as a consequence.

Could you let me know if this is still something you are working on and I'll do my best to help.

Regards, Steve.

http://www.oneworldmarket.co.uk