Hi,

I created a new class RegexpTableResultProvider in Search.php, which is basically a copy of FulltextTableResultProvider. Only the getWhere method is slightly changed:

    protected function getWhere($request) {
        $this->log->warn('getWhere ($request)');
        $this->log->warn($request);

        $where = '';
        foreach ($this->fulltextColumns as $column) {
            if ($where != '') {
                $where .= ' AND ';
            }
            $where .= "$column ~* '@$column@'";
        }
        return $where;
    }

In search.ini, the provider is activated with config.Adresses.provider.type = regexpTable.

There are a couple of drawabacks. E.g., at the moment the new class resides in Search.php, which is obviously not the best solution.


Regards,
Dirk



wochter wrote:
Hi,
i'd like to see how you wrote own provider for regular expressions.
Cold you send me and describe it please?
I need eliminate the upper/lower case problem too.

Thanx

wochter

Dirk Jesko  wrote / napísal(a):
  
Hello Véronique,

thanks. Now, recentering on a result works with

function recenter(id){
   if ($('search_config').value == 'Adresses') {
       $('id_recenter_ids').value = id; //id to recenter
       CartoWeb.trigger('Location.Recenter');
   }
}

My search works perfectly on seven columns (id, company name, city,
postal code, ...) of one table. I did everything according to the
documentation. After I found out, how the input fields etc. have to be
named, everything was fine. If I am not mistaken, there was one error in
the documentation. In Search.ajax.js, it should be 'if
(pluginOutput.htmlCode.Adresses) {' instead of 'if
(pluginOutput.htmlCode.myconfig) {'. If it helps, I could send you my
configuration and templates.

One thing that I do not like about the provided full text search is the
use of LIKE in the where clause, since you have to be careful with upper
and lower case. Therefore, I wrote my own provider using ~*, so I can
use regular expressions and it ignores upper and lower case.

I will now try a guided search.

Regards,
Dirk



Véro Herzl - Bluewin wrote:
    
Hello,

Yep, I think I know what is wrong. Try by putting
/
$('id_recenter_ids').value = id; //id to recenter
//$('recenter_scale').value = 2000;//scale for recentering
//$('recenter_doit').value = '0'; LINE TO CHANGE !!!!!
//CartoWeb.trigger('Location.Recenter');/

If I remember right I told it already to camptocamp so they can change
the documentation but unfortunately, it is not already done.

By the way, if ever you succeded in implementing the search plugin
with two columns of the same table or two columns of two different
tables, and if it is possible for you, I would kindly receive any
information on how to do it work as the documentation does not seem to
help me on that point.

Regards

Véronique

      
_______________________________________________
Cartoweb-users mailing list
Cartoweb-users@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/cartoweb-users

    


  
_______________________________________________
Cartoweb-users mailing list
Cartoweb-users@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/cartoweb-users

Reply via email to