Changeset 1616 for trunk/buildscripts
- Timestamp:
- 01/13/2007 04:39:48 PM (23 months ago)
- Location:
- trunk/buildscripts
- Files:
-
- 4 modified
-
classtree/build.php (modified) (1 diff)
-
index/build.php (modified) (2 diffs)
-
index/quickstart_index.php (modified) (7 diffs)
-
phing/tasks/QuickstartIndexTask.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/buildscripts/classtree/build.php
r1598 r1616 18 18 '/I18N/core', 19 19 '/3rdParty', 20 '/Web/Security' 20 '/Web/Security', 21 '/Configuration', 22 '/Web/Services/TFeedService.php', 23 '/Web/Services/IFeedContentProvider.php' 21 24 ); 22 25 $a=new ClassTreeBuilder($frameworkPath,$exclusions); -
trunk/buildscripts/index/build.php
r1055 r1616 10 10 11 11 //quickstart source and the index data target directories. 12 $quickstart_source = realpath(dirname(__FILE__).'/../texbuilder/ pages.php');12 $quickstart_source = realpath(dirname(__FILE__).'/../texbuilder/quickstart/pages.php'); 13 13 $quickstart_base = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/pages/'); 14 14 $quickstart_target = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index/quickstart/'); … … 47 47 foreach($hits as $hit) 48 48 echo " ".$hit->title."\n"; 49 49 50 50 $a = new Zend_Search_Lucene($api_target); 51 51 $query = $argv[1]; -
trunk/buildscripts/index/quickstart_index.php
r1055 r1616 5 5 private $_index; 6 6 private $_dir; 7 7 8 8 private $_base; 9 9 private $_source; 10 10 11 11 public function __construct($index_file, $base, $source) 12 12 { … … 16 16 $this->_source = $source; 17 17 } 18 18 19 19 public function create_index() 20 20 { … … 31 31 $this->add($file_content,$section, filemtime($page)); 32 32 $count++; 33 } 33 } 34 34 } 35 35 36 36 $this->_index->commit(); 37 echo "\n {$count} files indexed.\n"; 37 echo "\n {$count} files indexed.\n"; 38 38 } 39 39 40 40 public function add($content, $section, $mtime) 41 41 { … … 45 45 $link = "index.php?page=".preg_replace('/\/|\\\/', '.', $section); 46 46 $link = str_replace('.page', '', $link).'#'.$headers['section']; 47 47 48 48 //unsearchable text 49 49 $doc->addField(Zend_Search_Lucene_Field::UnIndexed('link', $link)); 50 50 $doc->addField(Zend_Search_Lucene_Field::UnIndexed('mtime', $mtime)); 51 51 $doc->addField(Zend_Search_Lucene_Field::UnIndexed('title', $headers['title'])); 52 $doc->addField(Zend_Search_Lucene_Field::UnIndexed('text', $headers['content'])); 53 52 $doc->addField(Zend_Search_Lucene_Field::UnIndexed('text', $headers['content'])); 53 54 54 //searchable text 55 55 $doc->addField(Zend_Search_Lucene_Field::Keyword('page', strtolower($headers['title']))); … … 57 57 $doc->addField(Zend_Search_Lucene_Field::Unstored('contents',$body)); 58 58 $this->_index->addDocument($doc); 59 } 59 } 60 60 } 61 62 function sanitize($input) 61 62 function sanitize($input) 63 63 { 64 64 return htmlentities(strip_tags( $input )); 65 } 66 65 } 66 67 67 public function index() 68 68 { 69 69 return $this->_index; 70 70 } 71 71 72 72 protected function split_headings($html) 73 73 { 74 74 $html = preg_replace('/<\/?com:TContent[^<]*>/', '', $html); 75 75 76 76 $html = preg_replace('/<b>([^<]*)<\/b>/', '$1', $html); 77 77 $html = preg_replace('/<i>([^<]*)<\/i>/', '$1', $html); 78 78 $html = preg_replace('/<tt>([^<]*)<\/tt>/', '$1', $html); 79 79 80 80 $html = preg_replace('/<h1([^>]*)>([^<]*)<\/h1>/', '<hh$1>$2</hh>', $html); 81 81 $html = preg_replace('/<h2([^>]*)>([^<]*)<\/h2>/', '<hh$1>$2</hh>', $html); 82 82 $html = preg_replace('/<h3([^>]*)>([^<]*)<\/h3>/', '<hh$1>$2</hh>', $html); 83 84 83 84 85 85 $sections = preg_split('/<hh[^>]*>([^<]+)<\/hh>/', $html,-1); 86 86 $headers = array(); … … 90 90 { 91 91 $content['title'] = trim($this->sanitize($headers[2][$i-1])); 92 $sec = array(); 93 preg_match('/"([^"]*)"/', $headers[1][$i-1], $sec); 94 $content['section'] = str_replace('"', '',$sec[0]); 92 $content['section'] = str_replace('"', '',trim($headers[1][$i-1],'"')); 95 93 $content['content'] = trim($this->sanitize($sections[$i])); 96 94 $contents[] = $content; … … 99 97 return $contents; 100 98 } 101 99 102 100 public function commit() 103 101 { 104 $this->_index->commit(); 102 $this->_index->commit(); 105 103 $count = $this->_index->count(); 106 104 echo "\nSaving search index ({$count}) to {$this->_dir}\n\n"; -
trunk/buildscripts/phing/tasks/QuickstartIndexTask.php
r1186 r1616 5 5 /** 6 6 * Task to index quickstart 7 */ 7 */ 8 8 class QuickstartIndexTask extends Task 9 9 { … … 21 21 set_include_path(get_include_path().PATH_SEPARATOR.realpath($zend_path)); 22 22 require_once ('Zend/Search/Lucene.php'); 23 23 24 24 require_once($srcdir.'/buildscripts/index/quickstart_index.php'); 25 $quickstart_source = $srcdir.'/buildscripts/texbuilder/ pages.php';25 $quickstart_source = $srcdir.'/buildscripts/texbuilder/quickstart/pages.php'; 26 26 $quickstart_base = $srcdir.'/demos/quickstart/protected/pages/'; 27 27 $quickstart = new quickstart_index($this->todir, realpath($quickstart_base), realpath($quickstart_source));
