本文整理汇总了PHP中Zend_Search_Lucene_Field::UnIndexed方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Search_Lucene_Field::UnIndexed方法的具体用法?PHP Zend_Search_Lucene_Field::UnIndexed怎么用?PHP Zend_Search_Lucene_Field::UnIndexed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Search_Lucene_Field
的用法示例。
在下文中一共展示了Zend_Search_Lucene_Field::UnIndexed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeDoc
/**
* Construct a Zend_Search_Lucene_Document object out of a document db row.
*
* @global string $urlServer
* @param object $docu
* @return Zend_Search_Lucene_Document
*/
protected function makeDoc($docu) {
global $urlServer;
$encoding = 'utf-8';
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('pk', 'doc_' . $docu->id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('pkid', $docu->id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('doctype', 'doc', $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('courseid', $docu->course_id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('title', Indexer::phonetics($docu->title), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('content', Indexer::phonetics($docu->description), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('filename', Indexer::phonetics($docu->filename), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('comment', Indexer::phonetics($docu->comment), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('creator', Indexer::phonetics($docu->creator), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('subject', Indexer::phonetics($docu->subject), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('author', Indexer::phonetics($docu->author), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('visible', $docu->visible, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('public', $docu->public, $encoding));
$urlAction = ($docu->format == '.dir') ? 'openDir' : 'download';
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', $urlServer
. 'modules/document/index.php?course=' . course_id_to_code($docu->course_id)
. '&' . $urlAction . '=' . $docu->path, $encoding));
return $doc;
}
示例2: actionIndexing
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndexing()
{
ini_set('max_execution_time', 0);
ob_start();
$index = new Zend_Search_Lucene(Yii::getPathOfAlias($this->_indexFilesPath), true);
$criteria = new CDbCriteria();
$criteria->compare('t.publish', 1);
$criteria->order = 'album_id DESC';
//$criteria->limit = 10;
$model = Albums::model()->findAll($criteria);
foreach ($model as $key => $item) {
if ($item->media_id != 0) {
$images = Yii::app()->request->baseUrl . '/public/album/' . $item->album_id . '/' . $item->cover->media;
} else {
$images = '';
}
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('id', CHtml::encode($item->album_id), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('media', CHtml::encode($images), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('title', CHtml::encode($item->title), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('body', CHtml::encode(Utility::hardDecode(Utility::softDecode($item->body))), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('url', CHtml::encode(Utility::getProtocol() . '://' . Yii::app()->request->serverName . Yii::app()->createUrl('album/site/view', array('id' => $item->album_id, 't' => Utility::getUrlTitle($item->title)))), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('date', CHtml::encode(Utility::dateFormat($item->creation_date, true) . ' WIB'), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('creation', CHtml::encode($item->user->displayname), 'utf-8'));
$index->addDocument($doc);
}
echo 'Album Lucene index created';
$index->commit();
$this->redirect(Yii::app()->createUrl('article/search/indexing'));
ob_end_flush();
}
示例3: _indexate
protected function _indexate($url)
{
if (!stristr($url, 'http://')) {
$url = HTTP_HOST . $url;
}
$url = substr($url, -1) == '/' ? substr($url, 0, -1) : $url;
if (!in_array($url, $this->_indexedUrl)) {
if (stristr($url, HTTP_HOST)) {
array_push($this->_indexedUrl, $url);
$html = file_get_contents($url);
libxml_use_internal_errors(true);
$doc = Zend_Search_Lucene_Document_Html::loadHTML($html);
libxml_use_internal_errors(false);
if (preg_match('/<\\!--index-->(.*)<\\!--\\/index-->/isu', $html, $matches)) {
$html = $matches[1];
}
$html = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $html);
$html = strip_tags($html);
$doc->addField(Zend_Search_Lucene_Field::Text('content', $html, 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('body', '', 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('url', $url, 'utf-8'));
$this->_indexHandle->addDocument($doc);
Zend_Registry::get('Logger')->info('Search index is created: ' . $url, Zend_Log::INFO);
foreach ($doc->getLinks() as $link) {
$temp = explode('.', $link);
$ext = end($temp);
if ($link == $ext || in_array($ext, array('php', 'html', 'txt', 'htm'))) {
$this->_indexate($link);
}
}
}
}
}
示例4: addAttributes
/**
* Adds attributes to be indexed
*
* @return string
**/
protected function addAttributes()
{
$this->addField(Zend_Search_Lucene_Field::Text('name', $this->getSourceModel()->getName(), self::ENCODING));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('short_content', $this->getSourceModel()->getShortDescription(), self::ENCODING));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('url', $this->getSourceModel()->getProductUrl(), self::ENCODING));
$this->addFilterableAttributes();
$this->addSearchableAttributes();
}
示例5: __construct
/**
* Constructor. Creates our indexable document and adds all
* necessary fields to it using the passed in document
*/
public function __construct($document)
{
$this->addField(Zend_Search_Lucene_Field::UnIndexed('id_entry', $document->getId()));
$this->addField(Zend_Search_Lucene_Field::Keyword('url', $document->getUrl()));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('creation_date', $document->getCreationDate()));
$this->addField(Zend_Search_Lucene_Field::Text('name', $document->getName()), 'utf-8');
$this->addField(Zend_Search_Lucene_Field::Text('content', $document->getDetails()));
$this->addField(Zend_Search_Lucene_Field::Text('tag', $document->getImplodedTags()));
}
示例6: _indexDocument
protected function _indexDocument($doc, $fields)
{
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('checkSum', md5($doc->body)));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('lastIndexed', time()));
foreach ($fields as $name => $value) {
$doc->addField(Zend_Search_Lucene_Field::Text($name, $value));
}
$this->_index->addDocument($doc);
Bbx_Log::write('Added ' . urldecode($doc->url) . ' to index', null, self::LOG);
}
示例7: _insert
private static function _insert($index, $item, $tags)
{
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Text('title', $item->name));
$doc->addField(Zend_Search_Lucene_Field::Text('item_id', strval($item->id)));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('image_id', strval($item->image_id)));
$doc->addField(Zend_Search_Lucene_Field::Text('description', $item->description));
$doc->addField(Zend_Search_Lucene_Field::Text('tag', $tags));
$index->addDocument($doc);
$index->commit();
}
示例8: testUnIndexed
public function testUnIndexed()
{
$field = Zend_Search_Lucene_Field::UnIndexed('field', 'value');
$this->assertEquals($field->boost, 1);
$this->assertEquals($field->encoding, '');
$this->assertEquals($field->isBinary, false);
$this->assertEquals($field->isIndexed, false);
$this->assertEquals($field->isStored, true);
$this->assertEquals($field->isTokenized, false);
$this->assertEquals($field->name, 'field');
$this->assertEquals($field->value, 'value');
}
示例9: __construct
public function __construct(&$doc, &$data, $course_id, $group_id, $user_id, $path, $additional_keyset = null)
{
$encoding = 'UTF-8';
//document identification and indexing
$this->addField(Zend_Search_Lucene_Field::Keyword('docid', $doc->docid, $encoding));
//document type : the name of the Moodle element that manages it
$this->addField(Zend_Search_Lucene_Field::Keyword('doctype', $doc->documenttype, $encoding));
//allows subclassing information from complex modules.
$this->addField(Zend_Search_Lucene_Field::Keyword('itemtype', $doc->itemtype, $encoding));
//caches the course context.
$this->addField(Zend_Search_Lucene_Field::Keyword('course_id', $course_id, $encoding));
//caches the originator's group.
$this->addField(Zend_Search_Lucene_Field::Keyword('group_id', $group_id, $encoding));
//caches the originator if any
$this->addField(Zend_Search_Lucene_Field::Keyword('user_id', $user_id, $encoding));
// caches the context of this information. i-e, the context in which this information
// is being produced/attached. Speeds up the "check for access" process as context in
// which the information resides (a course, a module, a block, the site) is stable.
$this->addField(Zend_Search_Lucene_Field::UnIndexed('context_id', $doc->contextid, $encoding));
//data for document
$this->addField(Zend_Search_Lucene_Field::Text('title', $doc->title, $encoding));
$this->addField(Zend_Search_Lucene_Field::Text('author', $doc->author, $encoding));
$this->addField(Zend_Search_Lucene_Field::UnStored('contents', $doc->contents, $encoding));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('url', $doc->url, $encoding));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('date', $doc->date, $encoding));
//additional data added on a per-module basis
$this->addField(Zend_Search_Lucene_Field::Binary('data', serialize($data)));
// adding a path allows the document to know where to find specific library calls
// for checking access to a module or block content. The Lucene records should only
// be responsible to bring back to that call sufficient and consistent information
// in order to perform the check.
$this->addField(Zend_Search_Lucene_Field::UnIndexed('path', $path, $encoding));
/*
// adding a capability set required for viewing. -1 if no capability required.
// the capability required for viewing is depending on the local situation
// of the document. each module should provide this information when pushing
// out search document structure. Although capability model should be kept flat
// there is no exclusion some module or block developpers use logical combinations
// of multiple capabilities in their code. This possibility should be left open here.
$this->addField(Zend_Search_Lucene_Field::UnIndexed('capabilities', $caps));
*/
/*
// Additional key set allows a module to ask for extensible criteria based search
// depending on the module internal needs.
*/
if (!empty($additional_keyset)) {
foreach ($additional_keyset as $keyname => $keyvalue) {
$this->addField(Zend_Search_Lucene_Field::Keyword($keyname, $keyvalue, $encoding));
}
}
}
示例10: processAtom
/**
* @param Zend_Feed_Atom $atom
*/
private function processAtom($atom)
{
$this->addField(Zend_Search_Lucene_Field::UnIndexed('id', $this->id));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('url', $this->url));
$this->addField(Zend_Search_Lucene_Field::Text('title', $atom->title()));
// Loop over each channel item and store relevant data
$text = '';
foreach ($atom as $item) {
$text .= $item->title();
$text .= ' ';
$text .= $item->content();
}
$this->addField(Zend_Search_Lucene_Field::Text('body', $text));
}
示例11: makeDoc
/**
* Construct a Zend_Search_Lucene_Document object out of a link db row.
*
* @global string $urlServer
* @param object $link
* @return Zend_Search_Lucene_Document
*/
protected function makeDoc($link) {
$encoding = 'utf-8';
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('pk', 'link_' . $link->id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('pkid', $link->id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('doctype', 'link', $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('courseid', $link->course_id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('title', Indexer::phonetics($link->title), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('content', Indexer::phonetics(strip_tags($link->description)), $encoding));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', $link->url, $encoding));
return $doc;
}
示例12: makeDoc
/**
* Construct a Zend_Search_Lucene_Document object out of a video db row.
*
* @global string $urlServer
* @param object $video
* @return Zend_Search_Lucene_Document
*/
protected function makeDoc($video) {
global $urlServer;
$encoding = 'utf-8';
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('pk', 'video_' . $video->id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('pkid', $video->id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('doctype', 'video', $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('courseid', $video->course_id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('title', Indexer::phonetics($video->title), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('content', Indexer::phonetics($video->description), $encoding));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', $urlServer . 'modules/video/file.php?course=' . course_id_to_code($video->course_id) . '&id=' . $video->id, $encoding));
return $doc;
}
示例13: index
public function index(Zfplanet_Model_Entry $entry)
{
if (is_null($this->_index)) {
return;
}
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('id', $entry->id, 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('publishedDate', $entry->publishedDate, 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Keyword('uri', $entry->uri, 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('title', $entry->title, 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnStored('content', $entry->content, 'utf-8'));
$this->_index->addDocument($doc);
$this->_index->commit();
$this->_index->optimize();
}
示例14: AddToIndex
static function AddToIndex(SearchableObject $object, $commitOnEnd = true)
{
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('combinedid', $object->getRelObjectManager() . $object->getRelObjectId()));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('objectid', $object->getRelObjectId()));
$doc->addField(Zend_Search_Lucene_Field::Keyword('manager', $object->getRelObjectManager()));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('column', $object->getColumnName()));
$doc->addField(Zend_Search_Lucene_Field::UnStored('text', $object->getContent()));
$doc->addField(Zend_Search_Lucene_Field::Text('workspaces', "ws" . $object->getProjectId() . " "));
$doc->addField(Zend_Search_Lucene_Field::Text('isprivate', ($object->getIsPrivate() ? '1' : '0') . " "));
self::GetIndex()->addDocument($doc);
if ($commitOnEnd) {
self::GetIndex()->commit();
}
return true;
}
示例15: makeDoc
/**
* Construct a Zend_Search_Lucene_Document object out of an exercise db row.
*
* @global string $urlServer
* @param object $exercise
* @return Zend_Search_Lucene_Document
*/
protected function makeDoc($exercise) {
global $urlServer;
$encoding = 'utf-8';
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('pk', 'exercise_' . $exercise->id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('pkid', $exercise->id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('doctype', 'exercise', $encoding));
$doc->addField(Zend_Search_Lucene_Field::Keyword('courseid', $exercise->course_id, $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('title', Indexer::phonetics($exercise->title), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('content', Indexer::phonetics(strip_tags($exercise->description)), $encoding));
$doc->addField(Zend_Search_Lucene_Field::Text('visible', $exercise->active, $encoding));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', $urlServer . 'modules/exercise/exercise_submit.php?course=' . course_id_to_code($exercise->course_id) . '&exerciseId=' . $exercise->id, $encoding));
return $doc;
}