1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
<?php
// $Header: /cvsroot/bitweaver/_bit_search/admin/admin_search_inc.php,v 1.17 2009/10/01 14:17:04 wjames5 Exp $
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See below for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
$feedback = array();
$formSearchToggles = array(
'search_stats' => array(
'label' => 'Search Statistics',
'note' => 'Record searches made and their frequency.',
// 'page' => 'SearchStats',
),
'search_index_on_submit' => array(
'label' => 'Index On Submit',
'note' => 'Index articles, blogs and wiki pages immdiately on submission. If unchecked, pages will be updated randomly according the the refresh rate below.',
),
);
$formSearchInts = array(
'search_refresh_rate' => array(
'label' => 'Search Refresh Rate',
'note' => 'Varies the rate at which updates to the search index are made, 1 = every page read, while rate>1 will introduce a random chance of a refresh every "rate" pages',
),
'search_min_wordlength' => array(
'label' => 'Minimum number of letters for search words',
'note' => 'By settings this value to 3, you can ignore search words such as "a" or "or", however searches for a number like "13" will be ignored as well.',
),
'search_max_syllwords' => array(
'label' => 'Maximum number of words',
'note' => 'The maximum number of words containing a syllable that can be serached for in any one search.',
),
'search_syll_age' => array(
'label' => 'Age in hours of search cache',
'note' => 'Define the Maximum age of cached search results for any given syllable. The results cache will be used to provide a search result if it is available, and will be cleared after either the age, or when the results cache reaches it\'s limit',
),
'search_lru_purge_rate' => array(
'label' => 'Least Recently Used (LRU) list purging rate',
'note' => 'Purge the results cache every "rate" pages. This will keep space available in the cache for new search results',
),
'search_lru_length' => array(
'label' => 'Least Recently Used (LRU) list length',
'note' => 'Limit the results cache to this number of entries',
),
);
if( !empty( $_REQUEST['del_index'] ) ) {
require_once( SEARCH_PKG_PATH.'/refresh_functions.php' );
delete_index_content_type( $_REQUEST["where"] );
$feedback['success'] = tra( "The search index was successfully deleted." );
}
if( !empty( $_REQUEST['del_index_reindex'] ) ) {
require_once( SEARCH_PKG_PATH.'/refresh_functions.php' );
$count = rebuild_index( $_REQUEST["where"] );
$feedback['success'] = tra( "The search index was successfully deleted." ).tra( "Number of items re-indexed" ).": ".$count;
}
if( !empty( $_REQUEST['del_searchwords'] ) ) {
require_once( SEARCH_PKG_PATH.'/refresh_functions.php' );
delete_search_words_and_syllables();
$feedback['success'] = tra( "The searchwords were successfully purged from the database." );
}
if( !empty( $_REQUEST['store_prefs'] ) ) {
foreach( $formSearchInts as $item => $data ) {
simple_set_int( $item, SEARCH_PKG_NAME );
$formSearchInts[$item]['value'] = $_REQUEST[$item];
}
foreach( $formSearchToggles as $item => $data ) {
simple_set_toggle( $item, SEARCH_PKG_NAME );
}
}
foreach( $formSearchInts as $item => $data ) {
$formSearchInts[$item]['value'] = $gBitSystem->getConfig( $item );
}
$gBitSmarty->assign( 'formSearchToggles', $formSearchToggles );
$gBitSmarty->assign( 'formSearchInts', $formSearchInts );
$gBitSmarty->assign( 'feedback', $feedback );
$formSearchTypeToggles = array(
'search_restrict_types' => array(
'label' => 'Restrict Types',
'note' => 'If selected the search will be limited to those selected below.'
),
);
$gBitSmarty->assign( 'formSearchTypeToggles', $formSearchTypeToggles );
// allow selection of what packages can have search
foreach( $gLibertySystem->mContentTypes as $cType ) {
$formSearchable['guids']['search_pkg_'.$cType['content_type_guid']] = $cType['content_description'];
}
if( !empty( $_REQUEST['store_content'] ) ) {
foreach( $formSearchTypeToggles as $item => $data ) {
simple_set_toggle( $item, SEARCH_PKG_NAME );
}
foreach( array_keys( $formSearchable['guids'] ) as $searchable ) {
$gBitSystem->storeConfig( $searchable, ( ( !empty( $_REQUEST['searchable_content'] ) && in_array( $searchable, $_REQUEST['searchable_content'] ) ) ? 'y' : NULL ), SEARCH_PKG_NAME );
}
}
// check the correct packages in the package selection
foreach( $gLibertySystem->mContentTypes as $cType ) {
if( $gBitSystem->getConfig( 'search_pkg_'.$cType['content_type_guid'] ) ) {
$formSearchable['checked'][] = 'search_pkg_'.$cType['content_type_guid'];
}
}
$gBitSmarty->assign( 'formSearchable', $formSearchable );
/* usually done in mod_package_search.php - but the module can be not here the first time */
if( empty( $contentTypes ) ) {
$contentTypes = array( '' => tra( 'All Content' ) );
foreach( $gLibertySystem->mContentTypes as $cType ) {
if( $gBitSystem->getConfig( 'search_pkg_'.$cType['content_type_guid']) ) {
$contentTypes[$cType['content_type_guid']] = $cType['content_description'];
}
}
$gBitSmarty->assign( 'contentTypes', $contentTypes );
}
?>
|