Multiple Field Search

Armin Burger armin.burger at GMX.NET
Tue Sep 6 18:07:38 EDT 2005


You can combine regular expressions and normal filter definitions. I 
think one also has to put parentheses around the filter expression (that 
I forgot in my example):

$qstring = "([FIELD1] > 23 AND '[FIELD2]' = 'bla')" ;

and for case insensitive queries

$qstring = "([FIELD1] > 23 AND '[FIELD2]' =~ /(B|b)(L|l)(A|a)/)";

I haven't found another possibility for case insensitive queries. I 
don't know if you can use PHP or PERL regex if PHP is compiled with 
regex=php instead of regex=system.

Armin

Abe Gillespie wrote:
> Ok, that sounds like good news.  Now if I did go to regular
> expressions to gain case insensitivity, do I lose the ability to query
> on multiple fields?
> 
> Thanks.
> -Abe
> 
> On 9/6/05, Armin Burger <armin.burger at gmx.net> wrote:
> 
>>Abe,
>>
>>with Mapscript you can search for multiple fields. It's not very clear
>>in the documentation, but it works.
>>
>>You have to specify an existing field of the layer for 'qitem', for
>>'qstring' you can define a filter statement that includes more than one
>>field/item, like
>>
>>$qitem = 'FIELD1';
>>$qstring = "[FIELD1] > 23 AND '[FIELD2]' = 'blabla'" ;
>>$mylayer->queryByAttributes($qitem, $qstring, MS_MULTIPLE);
>>
>>I think case-insensitive queries just work using regular expresions.
>>
>>Armin
>>
>>Abe Gillespie wrote:
>>
>>>Just for clarification, querying on multiple fields is NOT supported,
>>>correct?  Unfortunately my current client requires compound queries of
>>>this nature, but I forgot MapServer didn't natively do this.  I
>>>noticed that Chameleon actually queries DBFs external to MapServer's
>>>API.  I certainly can piggy-back on this method and just test each
>>>case in the compound query by hand and keep records that past the
>>>entire set of tests.  Unfortunately I'm no genius in search technology
>>>and my methods will be done linearlly and obviously SLOWLY.
>>>
>>>Can anyone offer any guidance, resources, or any other help?
>>>
>>>Thanks.
>>>-Abe
>>>
>>>
>>
> 
> 



More information about the mapserver-users mailing list