Skip to content
Snippets Groups Projects
Commit a219c1f0 authored by Michael Klier chi@chimeric.de's avatar Michael Klier chi@chimeric.de
Browse files

namespace-restricted fulltext-search part2

    - now its possible to restrict the fulltext-search to
      multible namespaces

      Examples:

        searchword @ns1 @ns2 @ns3

        "exact phrase" @ns1 @ns2 @ns3

darcs-hash:20060518204647-484ab-061521a81f13360e33496e5163e3cd263a9c1ad6.gz
parent d0ab54f6
No related branches found
No related tags found
No related merge requests found
......@@ -51,8 +51,9 @@ function ft_pageSearch($query,&$poswords){
// filter unmatched namespaces
if(!empty($q['ns'])) {
$pattern = implode('|^',$q['ns']);
foreach($docs as $key => $val) {
if(!preg_match('/^'.$q['ns'].'/',$key)) {
if(!preg_match('/^'.$pattern.'/',$key)) {
unset($docs[$key]);
}
}
......@@ -263,15 +264,15 @@ function ft_queryParser($query){
$q = array();
$q['query'] = $query;
$q['ns'] = '';
$q['ns'] = array();
$q['phrases'] = array();
$q['and'] = array();
$q['not'] = array();
// strip namespace from query
if(preg_match('/([^@]*)@([^@]*)/',$query,$match)) {
if(preg_match('/([^@]*)@(.*)/',$query,$match)) {
$query = $match[1];
$q['ns'] = $match[2];
$q['ns'] = explode('@',preg_replace("/ /",'',$match[2]));
}
// handle phrase searches
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment