[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Searching: grouping AND / OR searches on multiple fields with one se
Quoting Dan B (db@cyclonehq.dnsalias.net):
> At www.diabeticsupplies.com I am trying to modify a form based search to
> restrict search to 3 fields instead of all fields, while keeping only one
> mv_searchspec. This is the desired functionality (in pseudo-code):
>
> SELECT sku FROM products WHERE
> ( title LIKE se
> OR category LIKE se
> OR keywords LIKE se )
> AND
> ( sku LIKE [scratch skus_canview_all] )
>
> But right now, all I can get it to do is:
>
> SELECT sku FROM products WHERE
> ( :* LIKE se )
> AND
> ( sku LIKE [scratch skus_canview_all] )
>
> (Where :* is the mv_search_field: which translates to all fields)
>
First of all, you should put your qualifying condition first (the AND)
for performance. This applies to SQL databases as well as IC.
mv_search_group=1 for the AND condition
mv_search_group=2 for the OR conditions
To remove ambiguities, you can use
mv_search_relate=1 AND 2
I think there is an example in the "barry" subcat.html page.
--
Red Hat, Inc., 131 Willow Lane, Floor 2, Oxford, OH 45056
phone +1.513.523.7621 fax 7501 <mheins@redhat.com>
Function in chaos, finish in style. -- Unknown
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users