$opts = {
  before_match => "<b>",
  after_match => "</b>"
}

效果为 <b>keywords</b>

reference to hash 是一种可选参数的传递方式。

K. C.

2009/10/13 蓝天下云层上 <[email protected]>

>
> 函数为 $excerpts = $sph->BuildExcerpts($docs, $index, $words, $opts)
>
> opts项的说明为:
> opts
> A hash which contains additional optional highlighting parameters:
>
> before_match - a string to insert before a set of matching words,
> default is "<b>"
> after_match - a string to insert after a set of matching words,
> default is "<b>"
>
> 如何预定义这个别opts结构呢?
>
> 函数来自于Sphinx::Search模块
>
> http://search.cpan.org/~jjschutz/Sphinx-Search-0.22/lib/Sphinx/Search.pm#BuildExcerpts<http://search.cpan.org/%7Ejjschutz/Sphinx-Search-0.22/lib/Sphinx/Search.pm#BuildExcerpts>
> >
>

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。
 要在此论坛发帖,请发电子邮件到 [email protected]
 要退订此论坛,请发邮件至 [email protected]
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

回复