<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Build text snippets</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sphinxclient.addquery.html">SphinxClient::addQuery</a></div> <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.buildkeywords.html">SphinxClient::buildKeywords</a></div> <div class="up"><a href="class.sphinxclient.html">SphinxClient</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="sphinxclient.buildexcerpts" class="refentry"> <div class="refnamediv"> <h1 class="refname">SphinxClient::buildExcerpts</h1> <p class="verinfo">(PECL sphinx >= 0.1.0)</p><p class="refpurpose"><span class="refname">SphinxClient::buildExcerpts</span> — <span class="dc-title">Build text snippets</span></p> </div> <div class="refsect1 description" id="refsect1-sphinxclient.buildexcerpts-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>SphinxClient::buildExcerpts</strong></span> ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$docs</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$words</code></span> [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$opts</code></span> ] )</div> <p class="para rdfs-comment"> Connects to searchd, requests it to generate excerpts (snippets) from the given documents, and returns the results. </p> </div> <div class="refsect1 parameters" id="refsect1-sphinxclient.buildexcerpts-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">docs</code></em></span> <dd> <p class="para"> Array of strings with documents' contents. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">index</code></em></span> <dd> <p class="para"> Index name. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">words</code></em></span> <dd> <p class="para"> Keywords to highlight. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">opts</code></em></span> <dd> <p class="para"> Associative array of additional highlighting options (see below). </p> </dd> </dt> </dl> <table class="doctable table"> <caption><strong>Highlighting options</strong></caption> <thead> <tr> <th>Option</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>"before_match"</td> <td>A string to insert before a keyword match. Default is "<b>".</td> </tr> <tr> <td>"after_match"</td> <td>A string to insert after a keyword match. Default is "</b>".</td> </tr> <tr> <td>"chunk_separator"</td> <td>A string to insert between snippet chunks (passages). Default is " ... ".</td> </tr> <tr> <td>"limit"</td> <td>Maximum snippet size, in symbols (codepoints). Integer, default is 256.</td> </tr> <tr> <td>"around"</td> <td>How much words to pick around each matching keywords block. Integer, default is 5.</td> </tr> <tr> <td>"exact_phrase"</td> <td>Whether to highlight exact query phrase matches only instead of individual keywords. Boolean, default is <strong><code>FALSE</code></strong>.</td> </tr> <tr> <td>"single_passage"</td> <td>Whether to extract single best passage only. Boolean, default is <strong><code>FALSE</code></strong>.</td> </tr> </tbody> </table> </p> </div> <div class="refsect1 returnvalues" id="refsect1-sphinxclient.buildexcerpts-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns array of snippets on success or <strong><code>FALSE</code></strong> on failure. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sphinxclient.addquery.html">SphinxClient::addQuery</a></div> <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.buildkeywords.html">SphinxClient::buildKeywords</a></div> <div class="up"><a href="class.sphinxclient.html">SphinxClient</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>