function.swishresults-getparsedwords.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 114 行
HTML
114 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Get an array of parsed words</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.swishresult-stem.html">SwishResult->stem</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.swishresults-getremovedstopwords.html">SwishResults->getRemovedStopwords</a></div> <div class="up"><a href="ref.swish.html">Swish Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.swishresults-getparsedwords" class="refentry"> <div class="refnamediv"> <h1 class="refname">SwishResults->getParsedWords</h1> <p class="verinfo">(No version information available, might be only in CVS)</p><p class="refpurpose"><span class="refname">SwishResults->getParsedWords</span> — <span class="dc-title">Get an array of parsed words</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><b><b>SwishResults->getParsedWords</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$index_name</tt></span> )</div> <div class="warning"><b class="warning">Warning</b><p class="simpara">This function is<em class="emphasis">EXPERIMENTAL</em>. The behaviour of this function, its name, andsurrounding documentation may change without notice in a future release of PHP.This function should be used at your own risk.</p></div> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">indexi_name</tt></i></span> <dd> <p class="para"> The name of the index used to initialize <b class="classname">Swish</b> object. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> An array of parsed words with stopwords removed. The list of parsed words may be useful for highlighting search terms in the results. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 Basic <b>SwishResults->getParsedWords()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /><br /></span><span style="color: #007700">try {<br /><br /> </span><span style="color: #0000BB">$swish </span><span style="color: #007700">= new </span><span style="color: #0000BB">Swish</span><span style="color: #007700">(</span><span style="color: #DD0000">"index.swish-e"</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$results </span><span style="color: #007700">= </span><span style="color: #0000BB">$swish</span><span style="color: #007700">-></span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"'some characters' and numbers"</span><span style="color: #007700">);<br /><br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$results</span><span style="color: #007700">-></span><span style="color: #0000BB">getParsedWords</span><span style="color: #007700">(</span><span style="color: #DD0000">"index.swish-e"</span><span style="color: #007700">));<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$results</span><span style="color: #007700">-></span><span style="color: #0000BB">indexes</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">][</span><span style="color: #DD0000">'parsed_words'</span><span style="color: #007700">]); </span><span style="color: #FF8000">//same result in a different way<br /><br /></span><span style="color: #007700">} catch (</span><span style="color: #0000BB">SwishException $e</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"Error: "</span><span style="color: #007700">, </span><span style="color: #0000BB">$e</span><span style="color: #007700">-></span><span style="color: #0000BB">getMessage</span><span style="color: #007700">(), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?></span></span></code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents"><pre><div class="cdata"><pre>array(4) { [0]=> string(4) "some" [1]=> string(10) "characters" [2]=> string(3) "and" [3]=> string(7) "numbers"}array(4) { [0]=> string(4) "some" [1]=> string(10) "characters" [2]=> string(3) "and" [3]=> string(7) "numbers"}</pre></div> </pre></div> </div> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.swishresult-stem.html">SwishResult->stem</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.swishresults-getremovedstopwords.html">SwishResults->getRemovedStopwords</a></div> <div class="up"><a href="ref.swish.html">Swish Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?