Author: mj
Date: Mon Oct 24 12:21:11 2011
New Revision: 10172

Log:
Use ZSL query parsing in advanced search (behaviour is more consistent with 
simple search)

Modified:
   trunk/apps/qubit/modules/search/actions/advancedAction.class.php

Modified: trunk/apps/qubit/modules/search/actions/advancedAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/search/actions/advancedAction.class.php    Mon Oct 
24 12:15:50 2011        (r10171)
+++ trunk/apps/qubit/modules/search/actions/advancedAction.class.php    Mon Oct 
24 12:21:11 2011        (r10172)
@@ -125,12 +125,21 @@
       }
 
       // enclose phrase searches in quotes (strip existing ones)
-      if ('phrase' == $searchField['match']) {
+      if ('phrase' == $searchField['match'])
+      {
         $term = '"'.str_replace(array('"', "'"), '', 
strtolower($searchField['query'])).'"';
-      } else {
+      }
+      else
+      {
         $term = strtolower($searchField['query']);
       }
 
+      // limit to specified field
+      if (!empty($searchField['field']))
+      {
+        $term = $searchField['field'] . ':' . $term;
+      }
+
       // select which boolean operator to use
       if (!isset($searchField['operator'])) $searchField['operator'] = null;
       switch ($searchField['operator'])
@@ -149,7 +158,7 @@
           break;
       }
 
-      $queryBuilt->addSubquery(QubitSearch::getInstance()->addTerm($term, 
$searchField['field']), $token);
+      $queryBuilt->addSubquery(QubitSearch::getInstance()->parse($term), 
$token);
     }
 
     $query = new Zend_Search_Lucene_Search_Query_Boolean();

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to