当前位置: 首页>>代码示例>>PHP>>正文


PHP Solarium_Client::createAnalysisDocument方法代码示例

本文整理汇总了PHP中Solarium_Client::createAnalysisDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP Solarium_Client::createAnalysisDocument方法的具体用法?PHP Solarium_Client::createAnalysisDocument怎么用?PHP Solarium_Client::createAnalysisDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Solarium_Client的用法示例。


在下文中一共展示了Solarium_Client::createAnalysisDocument方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

<?php

require 'init.php';
htmlHeader();
// create a client instance
$client = new Solarium_Client($config);
// get an analysis document query
$query = $client->createAnalysisDocument();
$query->setShowMatch(true);
$query->setQuery('ipod');
$doc = new Solarium_Document_ReadWrite(array('id' => 'MA147LL', 'name' => 'Apple 60 GB iPod with Video Playback Black', 'manu' => 'Apple Computer Inc.', 'cat' => 'electronics', 'cat' => 'music', 'features' => 'iTunes, Podcasts, Audiobooks', 'features' => 'Stores up to 15,000 songs, 25,000 photos, or 150 hours of video', 'features' => '2.5-inch, 320x240 color TFT LCD display with LED backlight', 'features' => 'Up to 20 hours of battery life', 'features' => 'Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video', 'features' => 'Notes, Calendar, Phone book, Hold button, Date display, Photo wallet, Built-in games, JPEG photo playback, Upgradeable firmware, USB 2.0 compatibility, Playback speed control, Rechargeable capability, Battery level indication', 'includes' => 'earbud headphones, USB cable', 'weight' => 5.5, 'price' => 399.0, 'popularity' => 10, 'inStock' => true));
$query->addDocument($doc);
// this executes the query and returns the result
$result = $client->analyze($query);
// show the results
foreach ($result as $document) {
    echo '<hr><h2>Document: ' . $document->getName() . '</h2>';
    foreach ($document as $field) {
        echo '<h3>Field: ' . $field->getName() . '</h3>';
        $indexAnalysis = $field->getIndexAnalysis();
        if (!empty($indexAnalysis)) {
            echo '<h4>Index Analysis</h4>';
            foreach ($indexAnalysis as $classes) {
                echo '<h5>' . $classes->getName() . '</h5>';
                foreach ($classes as $result) {
                    echo 'Text: ' . $result->getText() . '<br/>';
                    echo 'Raw text: ' . $result->getRawText() . '<br/>';
                    echo 'Start: ' . $result->getStart() . '<br/>';
                    echo 'End: ' . $result->getEnd() . '<br/>';
                    echo 'Position: ' . $result->getPosition() . '<br/>';
                    echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '<br/>';
开发者ID:swapnilphalak,项目名称:crawl-anywhere,代码行数:31,代码来源:2.4.1-analysis-document.php


注:本文中的Solarium_Client::createAnalysisDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。