mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 11:44:10 +09:00
게시글을 태그로 검색할때 tags table을 이용하도록 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2915 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
95c53a9988
commit
bb065b6e77
4 changed files with 47 additions and 3 deletions
|
|
@ -194,8 +194,17 @@
|
|||
else $args->s_is_secret = '';
|
||||
break;
|
||||
case 'tag' :
|
||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||
$args->s_tags = $search_keyword;
|
||||
$oDB = &DB::getInstance();
|
||||
$tmp_str_arr = explode(' ',$search_keyword);
|
||||
$tmp_count = count($tmp_str_arr);
|
||||
$tag_arr = array();
|
||||
for($i=0;$i<$tmp_count;$i++) {
|
||||
$tmp_str = trim($tmp_str_arr[$i]);
|
||||
if(!$tmp_str) continue;
|
||||
$tag_arr[] = $oDB->addQuotes($tmp_str);
|
||||
}
|
||||
$args->s_tags = "'".implode("','",$tag_arr);
|
||||
$query_id = 'document.getDocumentListWithinTag';
|
||||
break;
|
||||
case 'readed_count' :
|
||||
$args->s_readed_count = (int)$search_keyword;
|
||||
|
|
|
|||
23
modules/document/queries/getDocumentListWithinTag.xml
Normal file
23
modules/document/queries/getDocumentListWithinTag.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<query id="getDocumentListWithinComment" action="select">
|
||||
<tables>
|
||||
<table name="documents" alias="documents" />
|
||||
<table name="tags" alias="tags"/>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="documents.*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" />
|
||||
<condition operation="equal" column="documents.document_srl" default="tags.document_srl" notnull="notnull" pipe="and" />
|
||||
<condition operation="in" column="tags.tag" var="s_tags" notnull="notnull" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="documents.list_order" order="asc" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="documents.document_srl" />
|
||||
</groups>
|
||||
</query>
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
// 검색대상 변수 설정
|
||||
$search_target = Context::get('search_target');
|
||||
if(!in_array($search_target, array('title','content','title_content','comment'))) $search_target = 'title';
|
||||
if(!in_array($search_target, array('title','content','title_content','comment','tag'))) $search_target = 'title';
|
||||
|
||||
// 검색어 변수 설정
|
||||
$is_keyword = Context::get('is_keyword');
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@
|
|||
**/
|
||||
function moduleInstall() {
|
||||
$oModuleController = &getController('module');
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
$oDB->addIndex("tags","idx_tag", array("document_srl","tag"));
|
||||
|
||||
// 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument에 대한 trigger 등록
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
|
||||
|
|
@ -31,6 +34,7 @@
|
|||
**/
|
||||
function checkUpdate() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
// 2007. 10. 17 trigger 등록이 안되어 있으면 등록
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true;
|
||||
|
|
@ -42,6 +46,9 @@
|
|||
// 2007. 10. 17 모듈이 삭제될때 등록된 태그도 모두 삭제하는 트리거 추가
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) return true;
|
||||
|
||||
// tag 테이블의 tag 컬럼에 index
|
||||
if(!$oDB->isIndexExists("tags","idx_tag")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -51,6 +58,7 @@
|
|||
function moduleUpdate() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
// 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument에 대한 trigger 등록
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
|
||||
|
|
@ -72,6 +80,10 @@
|
|||
if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after');
|
||||
|
||||
// tag 테이블의 tag 컬럼에 index
|
||||
if(!$oDB->isIndexExists("tags","idx_tag"))
|
||||
$oDB->addIndex("tags","idx_tag", array("document_srl","tag"));
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue