本文整理汇总了PHP中FinderIndexerResult类的典型用法代码示例。如果您正苦于以下问题:PHP FinderIndexerResult类的具体用法?PHP FinderIndexerResult怎么用?PHP FinderIndexerResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FinderIndexerResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Override method to index a certain result
*
* @param FinderIndexerResult $item Finder item
* @param string $format Formatting (html or text)
*
* @return null
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
/*
if (JComponentHelper::isEnabled($this->extension) == false)
{
return;
}
*/
// Prepare the item
$item->access = 1;
// Define these items as songs
$item->addTaxonomy('Type', 'Song');
// Add artist information
$item->addInstruction(FinderIndexer::META_CONTEXT, 'artist');
$item->addTaxonomy('Artist', $item->artist);
// Set language
//$item->setLanguage();
//$item->addTaxonomy('Language', $item->language);
// Set URLs
$item->route = 'index.php?option=com_music&view=song&id=' . $item->id;
$item->url = $item->route;
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Allow others to hook into our $item as well
FinderIndexerHelper::getContentExtras($item);
$this->indexer->index($item);
}
示例2: index
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
$item->body = FinderIndexerHelper::prepareContent($item->getElement('body'));
$item->summary = FinderIndexerHelper::prepareContent($item->getElement('body'));
$item->addTaxonomy('Type', 'FSF_FINDER_GLOSSARY');
$word = $item->title;
$anchor = strtolower(preg_replace("/[^A-Za-z0-9]/", '-', $word));
$letter = strtolower(substr($word, 0, 1));
$item->url = 'index.php?option=com_fsf&view=glossary&letter=' . $letter . '#' . $anchor;
$item->route = $item->url;
$item->state = $item->published;
$item->access = 1;
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
if (FSFJ3Helper::IsJ3()) {
$this->indexer->index($item);
} else {
FinderIndexer::index($item);
}
}
示例3: _index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param object The item to index as an FinderIndexerResult object.
* @throws Exception on database error.
*/
protected function _index(FinderIndexerResult $item)
{
// Build the necessary route and path information.
$item->url = $this->_getURL($item->topic);
$item->itemid = '100065';
$item->route = $item->url . '&post=' . $item->id . '&Itemid=' . $item->itemid . '#p' . $item->id;
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'display_name');
// Strip slashes!
$item->title = stripslashes($item->title);
$item->summary = stripslashes($item->summary);
$item->display_name = stripslashes($item->display_name);
$item->text = FinderIndexerHelper::prepareContent($item->summary);
// Translate the access group to an access level.
//$item->cat_access = $this->_getAccessLevel($item->cat_access);
// Inherit state and access form the category.
$item->state = 1;
$item->access = 0;
// Set the language.
$item->language = FinderIndexerHelper::getDefaultLanguage();
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Forum Post');
// Add the author taxonomy data.
if (!empty($item->author)) {
$item->addTaxonomy('Forum User', $item->display_name);
}
// Index the item.
FinderIndexer::index($item);
}
示例4: index
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_virtuemart', true);
$item->params->merge($registry);
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
$item->body = FinderIndexerHelper::prepareContent($item->body, $item->params);
// Build the necessary route and path information.
$item->url = "index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=206&virtuemart_product_id=" . $item->id;
$item->route = "index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=206&virtuemart_product_id=" . $item->id;
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true)) {
$item->title = $title;
}
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Translate the state. Articles should only be published if the category is published.
$item->state = 1;
$item->cat_state = 1;
$item->cat_access = 1;
$item->access = 1;
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'VM Product');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, 1, 1);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
示例5: index
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
$item->body = FinderIndexerHelper::prepareContent($item->getElement('body'));
$item->summary = FinderIndexerHelper::prepareContent($item->getElement('body'));
$item->addTaxonomy('Type', 'FSS_FINDER_KB_ARTICLE');
$item->url = 'index.php?option=com_fss&view=kb&kbartid=' . $item->getElement('id');
$item->route = $item->url;
$item->state = $item->getElement('pub');
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
if (FSSJ3Helper::IsJ3()) {
$this->indexer->index($item);
} else {
FinderIndexer::index($item);
}
}
示例6: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = $registry;
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
if ($item->slug instanceof JCategoryNode) {
$ads_id = $item->slug->id;
} else {
$ads_id = (int) $item->slug;
}
$adsmodelcontent = new AdsmanagerModelContent();
$ads_catid = $adsmodelcontent->getContent($ads_id, true)->catid;
$url = "index.php?option=com_adsmanager&view=details&id=" . $ads_id . "&catid=" . $ads_catid;
$xhtml = true;
$ssl = null;
$item->route = TRoute::_($url);
//$item->route = AdsmanagerHelperRoute::getAdsRoute($item->slug, $item->catslug);
//$item->route = AdsmanagerHelperRoute::_("index.php?option=com_adsmanager&view=details&id=".$row->id."&catid=".$row->catid);
$item->path = FinderIndexerHelper::getContentPath($item->route);
/*
* Add the meta-data processing instructions based on the newsfeeds
* configuration parameters.
*/
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Ads');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
示例7: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// load foundry config
$config = FD::config();
$privacy = FD::privacy($item->user_id);
//default access
$access = 1;
if ($config->get('users.indexer.privacy', 1)) {
$privacyValue = $privacy->getValue('profiles', 'search');
$item->privacy = $privacyValue;
if ($item->privacy == SOCIAL_PRIVACY_PUBLIC) {
$access = 1;
} else {
if ($item->privacy == SOCIAL_PRIVACY_MEMBER) {
$access = 2;
} else {
// this is not public / member items. let set the access to 'special'
$access = 3;
}
}
}
$user = FD::user($item->user_id);
$userAlias = $user->getAlias(false);
$contentSnapshot = array();
$userName = $user->getName($config->get('users.indexer.name'));
$userEmail = $config->get('users.indexer.email') ? $user->email : '';
$contentSnapshot[] = $userName;
if ($userEmail) {
// we need to check for the email field privacy
if ($config->get('users.indexer.privacy', 1)) {
$privacyModel = FD::model('Privacy');
$fieldPrivacyValue = $privacyModel->getFieldValue('field.joomla_email', $user->id);
if ($fieldPrivacyValue == SOCIAL_PRIVACY_PUBLIC || $fieldPrivacyValue == SOCIAL_PRIVACY_MEMBER) {
$contentSnapshot[] = $userEmail;
} else {
$userEmail = '';
}
} else {
$contentSnapshot[] = $userEmail;
}
}
// get data from customfields
// get customfields.
// $fieldsLib = FD::fields();
// $fieldModel = FD::model( 'Fields' );
// $fieldsResult = array();
// $options = array();
// $options['data'] = true;
// $options['dataId'] = $user->user_id;
// $options['dataType'] = SOCIAL_TYPE_USER;
// $options['searchable'] = 1;
// //todo: get customfields.
// $fields = $fieldModel->getCustomFields( $options );
// if( count( $fields ) > 0 )
// {
// //foreach( $fields as $item )
// foreach( $fields as $field )
// {
// $userFieldData = isset( $field->data ) ? $field->data : '';
// $args = array( $userFieldData );
// $f = array( &$field );
// $dataResult = @$fieldsLib->trigger( 'onIndexer' , SOCIAL_FIELDS_GROUP_USER , $f , $args );
// if( $dataResult !== false && count( $dataResult ) > 0 )
// $fieldsResult[] = $dataResult[0];
// }
// if( $fieldsResult )
// {
// $customFieldsContent = implode( ' ', $fieldsResult );
// $contentSnapshot[] = $customFieldsContent;
// }
// }
$content = implode(' ', $contentSnapshot);
// Build the necessary route and path information.
// we need to pass in raw url so that if the site on sef, smart serach will not create new item.
// index.php?option=com_easysocial&view=profile&id=84:jenny-siew
// $item->url = 'index.php?option=com_easysocial&view=profile&id=' . $userAlias;
$item->url = 'index.php?option=com_easysocial&view=profile&id=' . $user->id;
$item->route = $user->getPermalink();
$item->route = $this->removeAdminSegment($item->route);
$item->path = FinderIndexerHelper::getContentPath($item->route);
$userProfile = $user->getProfile();
$metaKey = $userName;
if ($userEmail) {
$metaKey .= ', ' . $userEmail;
}
//.........这里部分代码省略.........
示例8: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_jshopping', true);
$item->params->merge($registry);
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
$item->body = FinderIndexerHelper::prepareContent($item->body, $item->params);
// Build the necessary route and path information.
$item->url = 'index.php?option=com_jshopping&controller=product&task=view&category_id=' . $item->category_id . '&product_id=' . $item->product_id;
$item->route = 'index.php?option=com_jshopping&controller=product&task=view&category_id=' . $item->category_id . '&product_id=' . $item->product_id;
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true)) {
$item->title = $title;
}
// Add the meta-author.
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Product');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
if (version_compare(JVERSION, '3.0.0', 'ge')) {
$this->indexer->index($item);
} else {
FinderIndexer::index($item);
}
}
示例9: index
/**
* Main index function run when indexing happens
*
* @param FinderIndexerResult $item
* @return bool|void
*/
protected function index(FinderIndexerResult $item)
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
//Add the instructions
foreach ($this->instructions as $type => $instructions) {
foreach ($instructions as $instruction) {
$item->addInstruction($type, $instruction);
}
}
// Add the type taxonomy data.
$item->addTaxonomy('Type', $this->type_title);
FinderIndexerHelper::getContentExtras($item);
// Index the item.
if (method_exists('FinderIndexer', 'getInstance')) {
FinderIndexer::getInstance()->index($item);
} else {
FinderIndexer::index($item);
}
}
示例10: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = $registry;
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = WeblinksHelperRoute::getWeblinkRoute($item->slug, $item->catslug);
$item->path = FinderIndexerHelper::getContentPath($item->route);
/*
* Add the meta-data processing instructions based on the newsfeeds
* configuration parameters.
*/
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Web Link');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
FinderIndexer::index($item);
}
示例11: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 3.1
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
$item->setLanguage();
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_tags', true);
$item->params->merge($registry);
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = TagsHelperRoute::getTagRoute($item->slug);
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true)) {
$item->title = $title;
}
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Tag');
// Add the author taxonomy data.
if (!empty($item->author) || !empty($item->created_by_alias)) {
$item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author);
}
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Index the item.
$this->indexer->index($item);
}
示例12: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
$item->setLanguage();
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_knvbapi2', true);
$item->params->merge($registry);
$registry = null;
//release memory
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
$registry = null;
//release memory
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
$item->body = FinderIndexerHelper::prepareContent($item->body, $item->params);
if ($this->sub_layout != 'default') {
$view = $this->layout . '&layout=' . $this->sub_layout;
} else {
$view = $this->layout;
}
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $view);
$item->route = Knvbapi2HelperRoute::getTeamidRoute($item->slug, $item->language, $this->sub_layout);
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
if (!empty($title) and $this->params->get('use_menu_title', true)) {
$item->title = $title;
} else {
$item->title = $item->name;
}
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_name');
// Translate the state.
$item->state = $this->translateState($item->state);
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Teamid');
// Add the created_by taxonomy data.
if (!empty($item->created_by_alias)) {
$item->addTaxonomy('Author', !empty($item->created_by_name) ? $item->created_by_name : $item->created_by);
}
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
示例13: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
*
* @return void
*
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item)
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Forum Post');
// Add the author taxonomy data.
if (!empty($item->author)) {
$item->addTaxonomy('Author', $item->author);
}
// Add the category taxonomy data.
// $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
FinderIndexer::index($item);
}
示例14: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format. Not used.
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
$item->setLanguage();
// Check if the extension is enabled.
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialise the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_j2store', true);
$item->params->merge($registry);
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
$item->body = FinderIndexerHelper::prepareContent($item->body, $item->params);
//let us get the redirect choice
if ($this->params->get('redirect_to', 'j2store') == 'article') {
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->language);
$item->path = FinderIndexerHelper::getContentPath($item->route);
} else {
$menu_id = $this->params->get('menuitem_id');
$item->url = $this->getJ2StoreURL($item->j2store_product_id, $this->extension, $this->layout);
$item->route = 'index.php?option=com_j2store&view=products&task=view&id=' . $item->j2store_product_id . '&Itemid=' . $menu_id;
$item->path = FinderIndexerHelper::getContentPath($item->route);
}
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true)) {
$item->title = $title;
}
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Translate the state. Articles should only be published if the category is published.
$item->state = $this->translateState($item->state, $item->cat_state);
// Add the type taxonomy data.
$item->addTaxonomy('Type', $this->type_title);
// Add the author taxonomy data.
if (!empty($item->author) || !empty($item->created_by_alias)) {
$item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author);
}
// Add the category taxonomy data.
$item->addTaxonomy('J2Store Category', $item->category, $item->cat_state, $item->cat_access);
$brandmodel = F0FModel::getTmpInstance('Manufacturers', 'J2StoreModel');
$brandmodel->enabled(1);
FinderIndexerHelper::getContentExtras($item);
// Add the Brand taxonomy data.
$item->addTaxonomy('J2Store Brand', $item->brand);
// Index the item.
$this->indexer->index($item);
}
示例15: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
$item->setLanguage();
$extension = ucfirst(substr($item->extension, 4));
$item->url = $this->getURL($item->id, $item->extension, $this->layout);
$item->route = 'index.php?option=' . $this->extension . '&view=book&layout=' . $this->layout . '&id=' . $item->book_id;
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Book');
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Index the item.
$this->indexer->index($item);
}