[ic] Custom SearchOP

Paul Jordan jordan at gishnetwork.com
Mon Sep 10 14:04:16 EDT 2007


interchange-users-bounces at icdevgroup.org wrote:
> Jon Jensen wrote:
>> On Mon, 10 Sep 2007, Paul Jordan wrote:
>> 
>>> Shouldn't this
>>> 
>>> my @pat = split(/,/, $pat);
>>> 
>>> Be:
>>> 
>>> my @pat = split(/\,/, $pat);
>> 
>> Why? There's nothing special about , in a regex. Or did you find a
>> problem with it? 
>> 
>> Jon
>> 
> The split command works as expected when I use the SearchOp sub
> outside of Interchange.

Sorry, hit send too soon.

http://www.perl.com/doc/manual/html/pod/perlfunc/split.html

Now I know it's syntax. Obviously /,/,  looks odd to me as one comma is for
the split command itself, not the regex but I did not know the // was
expected.


> Would be interested in how I could "achieve this with a Mysql query
> and the IN operator" when using a search form including the other
> coordinated search items. 


[query
	SELECT *
	FROM	products
	WHERE prod_group = '[cgi prod_group]'
	AND 	category = '[cgi category]'
	AND 	model IN ('67','71','72','73')
]

Filter your cgi's of course.Then take your [cgi model] and format it into a
comma delimited quoted list. I take it you can get all this in one post:
55,63,65-68,70-73 ? 

I didn't know about the SearchOP though, so one may be more efficient than
the other. I'd think splitting the model years out once, then running it
through IN is efficient. SearchOP *might* be running your comparisons on
every record... But again, I don't know how SearchOP works


Paul Jordan




More information about the interchange-users mailing list