* finish task #40432.
This commit is contained in:
+1
-1
@@ -858,7 +858,7 @@ CREATE TABLE IF NOT EXISTS `zt_searchdict` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
-- DROP TABLE IF EXISTS `zt_searchindex`;
|
||||
CREATE TABLE IF NOT EXISTS `zt_searchindex` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`objectType` char(20) NOT NULL,
|
||||
`objectID` mediumint(9) NOT NULL,
|
||||
`title` text NOT NULL,
|
||||
|
||||
@@ -1298,9 +1298,6 @@ class bug extends control
|
||||
$this->qa->setMenu($this->products, $productID, $bug->branch);
|
||||
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve;
|
||||
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->bug->resolve;
|
||||
|
||||
$this->view->bug = $bug;
|
||||
$this->view->users = $users;
|
||||
$this->view->assignedTo = $assignedTo;
|
||||
|
||||
@@ -166,7 +166,8 @@ class search extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->send(array('result' => 'unfinished', 'message' => sprintf($this->lang->search->buildResult, zget($this->lang->searchObjects, ($result['type'] == 'case' ? 'testcase' : $result['type']), $result['type']), $result['count']),'next' => inlink('buildIndex', "type={$result['type']}&lastID={$result['lastID']}") ));
|
||||
$type = zget($this->lang->searchObjects, ($result['type'] == 'case' ? 'testcase' : $result['type']), $result['type']);
|
||||
return $this->send(array('result' => 'unfinished', 'message' => sprintf($this->lang->search->buildResult, $type, $type, $result['count']), 'type' => $type, 'count' => $result['count'], 'next' => inlink('buildIndex', "type={$result['type']}&lastID={$result['lastID']}") ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,19 @@ $(document).ready(function()
|
||||
}
|
||||
else
|
||||
{
|
||||
className = response.type + 'count';
|
||||
$typeCount = $('#resultBox .' + className)
|
||||
if($typeCount.length == 0)
|
||||
{
|
||||
$('#resultBox').append("<li class='text-success'>" + response.message + "</li>");
|
||||
}
|
||||
else
|
||||
{
|
||||
count = parseInt($typeCount.html()) + parseInt(response.count);
|
||||
$typeCount.html(count);
|
||||
}
|
||||
|
||||
$('#execButton').attr('href', response.next);
|
||||
$('#resultBox').append("<li class='text-success'>" + response.message + "</li>");
|
||||
return $('#execButton').click();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ $lang->search->preview = 'Preview';
|
||||
$lang->search->result = 'Search Results';
|
||||
$lang->search->buildSuccessfully = 'Search index initialized.';
|
||||
$lang->search->executeInfo = '%s search results for you in %s seconds.';
|
||||
$lang->search->buildResult = 'Created index %s and added %s records.';
|
||||
$lang->search->buildResult = "Create index %s and created <strong class='%scount'>%s</strong> records.";
|
||||
|
||||
$lang->search->modules['all'] = 'All';
|
||||
$lang->search->modules['task'] = 'Task';
|
||||
|
||||
@@ -68,7 +68,7 @@ $lang->search->preview = 'Preview';
|
||||
$lang->search->result = 'Search Results';
|
||||
$lang->search->buildSuccessfully = 'Search index initialized.';
|
||||
$lang->search->executeInfo = '%s search results for you in %s seconds.';
|
||||
$lang->search->buildResult = 'Created index %s and added %s records.';
|
||||
$lang->search->buildResult = "Create index %s and created <strong class='%scount'>%s</strong> records.";
|
||||
|
||||
$lang->search->modules['all'] = 'All';
|
||||
$lang->search->modules['task'] = 'Task';
|
||||
|
||||
@@ -68,7 +68,7 @@ $lang->search->preview = 'Preview';
|
||||
$lang->search->result = 'Search Results';
|
||||
$lang->search->buildSuccessfully = 'Search index initialized.';
|
||||
$lang->search->executeInfo = '%s search results for you in %s seconds.';
|
||||
$lang->search->buildResult = 'Created index %s and added %s records.';
|
||||
$lang->search->buildResult = "Create index %s and created <strong class='%scount'>%s</strong> records.";
|
||||
|
||||
$lang->search->modules['all'] = 'All';
|
||||
$lang->search->modules['task'] = 'Task';
|
||||
|
||||
@@ -68,7 +68,7 @@ $lang->search->preview = 'Preview';
|
||||
$lang->search->result = 'Kết quả tìm kiếm';
|
||||
$lang->search->buildSuccessfully = 'Tìm kiếm khởi tạo chỉ mục.';
|
||||
$lang->search->executeInfo = '%s kết quả tìm kiếm trong %s giây';
|
||||
$lang->search->buildResult = 'Chỉ mục được tao %s và được thêm %s mục';
|
||||
$lang->search->buildResult = "Create index %s and created <strong class='%scount'>%s</strong> records.";
|
||||
|
||||
$lang->search->modules['all'] = 'Tất cả';
|
||||
$lang->search->modules['task'] = 'Nhiệm vụ';
|
||||
|
||||
@@ -68,7 +68,7 @@ $lang->search->preview = '预览';
|
||||
$lang->search->result = '搜索结果';
|
||||
$lang->search->buildSuccessfully = '初始化搜索索引成功';
|
||||
$lang->search->executeInfo = '为您找到相关结果%s个,耗时%s秒';
|
||||
$lang->search->buildResult = '创建 %s 索引, 新增 %s 条记录;';
|
||||
$lang->search->buildResult = "创建 %s 索引, 已创建 <strong class='%scount'>%s</strong> 条记录;";
|
||||
|
||||
$lang->search->modules['all'] = '全部';
|
||||
$lang->search->modules['task'] = '任务';
|
||||
|
||||
+15
-3
@@ -684,7 +684,7 @@ class searchModel extends model
|
||||
$index->content = $contentSplited['words'];
|
||||
|
||||
$this->saveDict($titleSplited['dict'] + $contentSplited['dict']);
|
||||
$this->dao->replace(TABLE_SEARCHINDEX)->data($index)->exec();
|
||||
$this->dao->insert(TABLE_SEARCHINDEX)->data($index)->exec();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -697,10 +697,15 @@ class searchModel extends model
|
||||
*/
|
||||
public function saveDict($dict)
|
||||
{
|
||||
static $savedDict;
|
||||
if(empty($savedDict)) $savedDict = $this->dao->select("`key`")->from(TABLE_SEARCHDICT)->fetchPairs('key', 'key');
|
||||
foreach($dict as $key => $value)
|
||||
{
|
||||
if(!is_numeric($key) or empty($value) or strlen($key) != 5) continue;
|
||||
$this->dao->replace(TABLE_SEARCHDICT)->data(array('key' => $key, 'value' => $value))->exec();
|
||||
if(isset($savedDict[$key])) continue;
|
||||
|
||||
$this->dao->insert(TABLE_SEARCHDICT)->data(array('key' => $key, 'value' => $value))->exec();
|
||||
$savedDict[$key] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1112,7 +1117,14 @@ class searchModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
foreach($dataList as $data) $this->saveIndex($module, $data);
|
||||
$savedIndex = $this->dao->select('*')->from(TABLE_SEARCHINDEX)->where('objectType')->eq($module)->andWhere('objectID')->in(array_keys($dataList))->fetchPairs('objectID', 'objectID');
|
||||
$fields = $this->config->search->fields->{$module};
|
||||
foreach($dataList as $data)
|
||||
{
|
||||
if(empty($fields)) continue;
|
||||
if(isset($savedIndex[$data->{$fields->id}])) continue;
|
||||
$this->saveIndex($module, $data);
|
||||
}
|
||||
return array('type' => $module, 'count' => count($dataList), 'lastID' => max(array_keys($dataList)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user