function testGetAllPages() { if (!DocumentationSearch::enabled()) { return; } DocumentationService::set_automatic_registration(false); DocumentationService::register('docs-search', BASE_PATH . '/sapphiredocs/tests/docs-search/'); $search = DocumentationSearch::get_all_documentation_pages(); $this->assertEquals(7, $search->Count(), '5 pages. 5 pages in entire folder'); }
/** * Enable searching documentation */ public static function enable() { self::$enabled = true; // include the zend search functionality set_include_path(dirname(dirname(__FILE__)) . '/thirdparty/' . PATH_SEPARATOR . get_include_path()); require_once 'Zend/Search/Lucene.php'; }
/** * Documentation Basic Search Form * * Integrates with sphinx * @return Form */ function DocumentationSearchForm() { if (!DocumentationSearch::enabled()) { return false; } $query = isset($_REQUEST['Search']) ? Convert::raw2xml($_REQUEST['Search']) : ""; $fields = new FieldSet(new TextField('Search', _t('DocumentationViewer.SEARCH', 'Search'), $query)); $actions = new FieldSet(new FormAction('results', 'Search')); $form = new Form($this, 'DocumentationSearchForm', $fields, $actions); $form->disableSecurityToken(); $form->setFormMethod('get'); $form->setFormAction(self::$link_base . 'DocumentationSearchForm'); return $form; }