Commit 6d2fdbb1 authored by lphuberdeau's avatar lphuberdeau

[ROLLBACK] r36017 Too many deep behavior changes to what is documented

parent 9969461b
......@@ -279,21 +279,12 @@ class UnifiedSearchLib
$query->filterCategory($filter['categories'], isset($filter['deep']));
}
if (isset($filter['deepcategories']) && $filter['deepcategories']) {
$query->filterCategory($filter['deepcategories'], true);
}
if (isset($filter['tags']) && $filter['tags']) {
$query->filterTags($filter['tags']);
}
if (isset($filter['content']) && $filter['content']) {
if (isset($filter['field']) && $filter['field']) {
$field = $filter['field'];
} else {
$field = TikiLib::lib('tiki')->get_preference('unified_default_content', array('contents'), true);
}
$query->filterContent($filter['content'], $field);
$query->filterContent($filter['content'], TikiLib::lib('tiki')->get_preference('unified_default_content', array('contents'), true));
}
if (isset($filter['autocomplete']) && $filter['autocomplete']) {
......@@ -315,11 +306,9 @@ class UnifiedSearchLib
unset($filter['type']);
unset($filter['categories']);
unset($filter['deepcategories']);
unset($filter['deep']);
unset($filter['tags']);
unset($filter['content']);
unset($filter['field']);
unset($filter['language']);
unset($filter['autocomplete']);
......
......@@ -27,8 +27,13 @@ function wikiplugin_list($data, $params)
$alternate = null;
$output = null;
$subPlugins = array();
$filter = array();
$contentfilters = array();
$query = new Search_Query;
$query->setWeightCalculator($unifiedsearchlib->getWeightCalculator());
if (isset($_REQUEST['offset'])) {
$query->setRange($_REQUEST['offset']);
}
$matches = WikiParser_PluginMatcher::match($data);
$argumentParser = new WikiParser_PluginArgumentParser;
......@@ -38,40 +43,32 @@ function wikiplugin_list($data, $params)
$arguments = $argumentParser->parse($match->getArguments());
foreach ($arguments as $key => $value) {
if ($name == 'filter') {
if ($key == 'content') {
$contentfilters[] = array('value' => $value, 'arguments' => $arguments);
} else {
$filter[$key] = $value;
}
} elseif ($name == 'format' && $key == 'name') {
wpformat_format_name($subPlugins, $value, $match->getBody());
} elseif ($name == 'sort' && $key == 'mode') {
$sort_mode = $value;
$function = "wpquery_{$name}_{$key}";
if (function_exists($function)) {
$function($query, $value, $arguments);
}
$function = "wpformat_{$name}_{$key}";
if (function_exists($function)) {
$function($subPlugins, $value, $match->getBody());
}
}
if ($name == 'output') {
$output = $match;
} elseif ($name == 'alternate') {
$alternate = $match->getBody();
}
}
$query = $unifiedsearchlib->buildQuery($filter);
foreach ($contentfilters as $cf) {
wpquery_filter_content($query, $cf['value'], $cf['arguments']);
}
if (isset($_REQUEST['offset'])) {
$query->setRange($_REQUEST['offset']);
if ($name == 'alternate') {
$alternate = $match->getBody();
}
}
$query->filterPermissions(Perms::get()->getGroups());
if (isset($_REQUEST['sort_mode'])) {
$sort_mode = $_REQUEST['sort_mode'];
}
if (isset($sort_mode)) {
$query->setOrder($sort_mode);
$query->setOrder($_REQUEST['sort_mode']);
}
$index = $unifiedsearchlib->getIndex();
......@@ -122,6 +119,21 @@ function wikiplugin_list($data, $params)
return $out;
}
function wpquery_filter_type($query, $value)
{
$query->filterType($value);
}
function wpquery_filter_categories($query, $value)
{
$query->filterCategory($value);
}
function wpquery_filter_deepcategories($query, $value)
{
$query->filterCategory($value, true);
}
function wpquery_filter_content($query, $value, array $arguments)
{
if (isset($arguments['field'])) {
......@@ -133,6 +145,16 @@ function wpquery_filter_content($query, $value, array $arguments)
$query->filterContent($value, $fields);
}
function wpquery_filter_language($query, $value)
{
$query->filterLanguage($value);
}
function wpquery_sort_mode($query, $value)
{
$query->setOrder($value);
}
function wpformat_format_name(&$subPlugins, $value, $body)
{
$subPlugins[$value] = new Search_Formatter_Plugin_WikiTemplate($body);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment