[ic] Abbreviated random search

Stefan Hornburg (Racke) racke at linuxia.de
Tue Aug 31 06:27:46 UTC 2010


On 08/30/2010 10:58 PM, Tom Friedel wrote:
> I inherited many instances of something like this
> [loop search="
> fi=products/st=db/co=1/sf=prod_group/se=Parts/op=rm/nu=0/ml=1 "]
> and want to do a Mysql search with 'order by rand()' and 'order by
> rand(seed)'
> I tried /tf/rand() with no luck.
> The code actually looks like
> [loop random="[control matches 100]" serch=...
> and I am not sure what the random= does if anything because it is not
> documented with loop tag.

random=yes sorts the results randomly.
random=20 picks out 20 random records out of the result set.

> Is there anyway I can keep the structure of this code and use the mysql
> 'order by rand(seed) functionality?

You could transform [loop] statements into [query] statements.
With prefix=loop you avoid changes in the body of the [loop].

Regards
	Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team




More information about the interchange-users mailing list