本文整理汇总了PHP中Search::addKeywords方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::addKeywords方法的具体用法?PHP Search::addKeywords怎么用?PHP Search::addKeywords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::addKeywords方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($key_id)
{
$db = new PHPWS_DB('ps_text');
$result = $db->saveObject($this);
if (PHPWS_Error::isError($result)) {
return $result;
}
$search = new Search($key_id);
$search->addKeywords($this->content);
return $search->save();
}
示例2: save
public function save()
{
PHPWS_Core::initModClass('search', 'Search.php');
if (!$this->id) {
$new = true;
$this->create_date = time();
} else {
$new = false;
}
$this->last_updated = time();
// If this page has a parent and the order is not set
// then increment
if (!$this->page_order && $this->parent_page) {
$page_order = $this->getLastPage();
if (!PHPWS_Error::logIfError($page_order)) {
$this->page_order = $page_order + 1;
} else {
$this->page_order = 1;
}
}
$db = new PHPWS_DB('ps_page');
if (PHPWS_Error::logIfError($db->saveObject($this))) {
return false;
}
$this->saveKey();
if ($new && Current_User::isRestricted('pagesmith')) {
Current_User::giveItemPermission($this->_key);
}
$search = new Search($this->key_id);
$search->resetKeywords();
$search->addKeywords($this->title);
PHPWS_Error::logIfError($search->save());
foreach ($this->_sections as $section) {
$section->pid = $this->id;
PHPWS_Error::logIfError($section->save($this->key_id));
}
PHPWS_Cache::remove($this->cacheKey());
}
示例3: pagesmithSearchIndex
/**
* Versions prior to 1.1.0 didn't have search. This function
* plugs in values for all current text sections.
*/
function pagesmithSearchIndex()
{
PHPWS_Core::initModClass('search', 'Search.php');
$db = new PHPWS_DB('ps_text');
$db->addColumn('id');
$db->addColumn('content');
$db->addColumn('ps_page.key_id');
$db->addColumn('ps_page.title');
$db->addWhere('ps_text.pid', 'ps_page.id');
$db->addOrder('pid');
$db->addOrder('secname');
$result = $db->select();
if (!empty($result)) {
if (PHPWS_Error::logIfError($result)) {
return false;
}
foreach ($result as $pg) {
$search = new Search($pg['key_id']);
$search->addKeywords($pg['content']);
$search->addKeywords($pg['title']);
PHPWS_Error::logIfError($search->save());
}
}
return true;
}
示例4: save
function save($save_key = TRUE)
{
$db = new PHPWS_DB('wiki_pages');
$result = $db->saveObject($this);
if (PEAR::isError($result)) {
return $result;
}
if ($save_key) {
$result = $this->saveKey();
if (PEAR::isError($result)) {
return $result;
}
$search = new Search($this->key_id);
$search->resetKeywords();
$search->addKeywords($this->title);
$search->addKeywords($this->pagetext);
$search->save();
}
}
示例5: addKeyword
public static function addKeyword($keyword, $key_id)
{
$search = new Search((int) $key_id);
if ($search->_error) {
PHPWS_Error::log($search->_error);
return;
}
$search->addKeywords($keyword, FALSE);
return $search->save();
}
示例6: save
public function save()
{
PHPWS_Core::initModClass('search', 'Search.php');
$table = $this->_schedule->getEventTable();
if (!PHPWS_DB::isTable($table)) {
return PHPWS_Error::get(CAL_EVENT_TABLE_MISSING, 'calendar', 'Calendar_Event::save');
}
$db = new PHPWS_DB($table);
$result = $db->saveObject($this);
if (PHPWS_Error::isError($result)) {
return $result;
} elseif (!$this->pid) {
// only save the key if the pid is 0
// ie source event not copy
if (empty($this->key_id)) {
$save_key = true;
} else {
$save_key = false;
}
$key = $this->saveKey();
if (PHPWS_Error::isError($key)) {
PHPWS_Error::log($key);
return false;
}
if ($save_key) {
$db->saveObject($this);
}
/* save search settings */
$search = new Search($this->key_id);
$search->addKeywords($this->summary);
$search->addKeywords($this->location);
$search->addKeywords($this->description);
$search->save();
return true;
}
}
示例7: save
public function save()
{
$db = new PHPWS_DB('blog_entries');
if (empty($this->id)) {
$this->create_date = time();
if (!$this->publish_date) {
$this->publish_date = $this->create_date;
}
if (Current_User::isLogged()) {
$this->author_id = Current_User::getId();
$this->author = Current_User::getDisplayName();
} elseif (empty($this->author)) {
$this->author_id = 0;
$this->author = dgettext('blog', 'Anonymous');
}
}
if (Current_User::isLogged()) {
$this->updater_id = Current_User::getId();
$this->updater = Current_User::getDisplayName();
} elseif (empty($this->updater)) {
$this->updater_id = 0;
$this->updater = dgettext('blog', 'Anonymous');
}
$this->update_date = time();
if (empty($this->entry)) {
$this->entry = '';
}
$result = $db->saveObject($this);
if (PHPWS_Error::isError($result)) {
return $result;
}
$update = !$this->key_id ? true : false;
$this->saveKey();
if ($update) {
$db->saveObject($this);
}
$search = new Search($this->key_id);
$search->resetKeywords();
$search->addKeywords($this->title);
$search->addKeywords($this->summary);
$search->addKeywords($this->entry);
$result = $search->save();
if (PHPWS_Error::isError($result)) {
return $result;
}
return $this->id;
}