fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [17123] full text search


From: sigurdne
Subject: [Fmsystem-commits] [17123] full text search
Date: Wed, 27 Sep 2017 10:22:49 -0400 (EDT)

Revision: 17123
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17123
Author:   sigurdne
Date:     2017-09-27 10:22:49 -0400 (Wed, 27 Sep 2017)
Log Message:
-----------
full text search

Modified Paths:
--------------
    trunk/property/inc/class.solocation.inc.php

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2017-09-27 08:06:18 UTC (rev 
17122)
+++ trunk/property/inc/class.solocation.inc.php 2017-09-27 14:22:49 UTC (rev 
17123)
@@ -865,12 +865,29 @@
 
                                        if ($sub_query_tenant)
                                        {
-                                               $sub_query = "OR 
fm_tenant.last_name $this->like '%$query%' OR fm_tenant.first_name $this->like 
'%$query%' OR fm_tenant.contact_phone $this->like '%$query%'";
+                                               if(strpos($query, ' '))
+                                               {
+                                                       $query_arr = explode(' 
', $query);
+                                                       $sub_query = " OR 
to_tsvector(fm_tenant.first_name || ' ' || fm_tenant.last_name ) @@ 
to_tsquery('{$query_arr[0]} & {$query_arr[1]}')";
+                                                       $sub_query .= " OR 
to_tsvector(fm_tenant.last_name || ' ' || fm_tenant.first_name ) @@ 
to_tsquery('{$query_arr[0]} & {$query_arr[1]}')";
+                                               }
+                                               else
+                                               {
+                                                       $sub_query = "OR 
fm_tenant.last_name $this->like '%$query%' OR fm_tenant.first_name $this->like 
'%$query%' OR fm_tenant.contact_phone $this->like '%$query%'";
+                                               }
                                        }
 
                                        if ($sub_query_street)
                                        {
-                                               $sub_query .= "OR 
fm_streetaddress.descr $this->like '%$query%'";
+                                               if(strpos($query, ' '))
+                                               {
+                                                       $query_arr = explode(' 
', $query);
+                                                       $sub_query .= " OR 
to_tsvector(fm_streetaddress.descr || ' ' || street_number ) @@ 
to_tsquery('{$query_arr[0]} & {$query_arr[1]}')";
+                                               }
+                                               else
+                                               {
+                                                       $sub_query .= " OR 
fm_streetaddress.descr $this->like '%$query%'";
+                                               }
                                        }
 
                                        $query_name = '';




reply via email to

[Prev in Thread] Current Thread [Next in Thread]