Skip navigation.

JL空间

contact to me: liuping.james#gmail.com (use @ replace #)

看了下源代码,,整理了下 全文检索的分词大致步骤

,

适用目前大多数搜索引擎。

见我另一个blog

http://imjl.javaeye.com/admin/show/51421

整了个简单的msn机器人

, ,

使用方法: http://s.shttnet.com/robot.html

技术: msn机器人+solr

应用: 运价查询

深入: 加强分词,提升java code,这些还要看看它应用。如果人多再考虑深入

简单介绍solr

国内研究solr的人很少,所以中文资料也很少.但是有些翻译我觉得不准确,所以今天说下.

以下英文都是摘自solr的wiki页面,我只是做个大概翻译,翻译比较粗糙。大概就这么个意思。

What does Solr stand for?

Arguably, it stands for "Searching On Lucene w/Replication" -- but it should not be considered an acronym.

Solr这几个字母什么含义?
它可以理解成"基于lucene并且带复制"--但不能看成是它的缩写。



Where did the initial version of Solr come from?

"Solar" was initially developed by [WWW] CNET Networks as an in-house search platform beginning in late fall 2004. By summer 2005, CNET's product catalog was [WWW] powered by Solar, and several other CNET applications soon followed. In January 2006 CNET [WWW] Granted the existing code base to the ASF to become the "Solr" project.

Solr的由来

solr最初是cnet网站于2004秋天做为内部搜索平台开始使用。2005年夏天,CNET的产品目录变成SOLAR提供,同时一部分相关程序也跟进。2006年CNET授权现存的代码基于ASF,就这样就变成了SOLR项目。


Is Solr Stable? Is it "Production Quality?"

Solr is currently being used to power search applications on several high traffic publicly accessible websites.

solr是否稳定?它是否具备了生产特性?(国外一般把投入正式使用的称为生产)
Solr目前已经为一些高负荷的公开网站用来加强搜索。(wiki还列举了些一些网站,有兴趣的可以自己去看下)


SOLR网站:http://lucene.apache.org/solr/

SOLR WIKI:http://wiki.apache.org/solr/


目前SOLR网站提供的solr不支持中文。



上海至全球实时运价查询 http://s.shttnet.com

, ,

这是最近做的网站,,,花了三天时间.

代码其实只用了半天写,,关键还是网站排版和乱七八糟的excel数据处理.


这个网站是solr的中文实际应用

主要是全文检索,价格排序,也是个ajax应用.




solr中文检索

嘿嘿,,至少我做的时候国内还没:D






Solr介绍

Solr 企业级搜索引擎简介



Solr 是一个独立的企业级搜索引擎服务器,并提供类似web-service 的API接口。可以通过http协议把文档以xml格式的方式放入索引库。同样通过HTTP的GET协议接收XML格式的文档。

看到这里我想起了车东主持开发的WebLucene,早在3年前车东就为lucene提供了XML接口,后来吕克让也在此基础上添加了很多功能,大大方便了后继的维护工作。那么Solr有什么特别的呢?

首先,Solr 师出名门,apache的孵化项目:http://incubator.apache.org/solr/

具体功能看看下表吧:

* 高级全文搜索功能 ;
* 为高Web负载做了特别的优化;
* 基于XML和HTTP的标准开放接口 ;
* 功能完善的HTML的管理界面;
* 可伸缩,可以高效复制到其它Solr服务器;
* 基于XML的灵活性和可适配性;
* 提供支持插件的架构;

Solr 使用的是Lucene包,并对其进行了扩展

* 支持实用数据Schema, 比如:动态字段和唯一键等
* 对Lucene 查询语言的强大扩展;
* 支持动态搜索结果分组和过滤
* 高级的可配置文本分析功能;
* 高可配置性和用户可扩展的缓存服务;
* 提供性能优化参数;
* 使用XML在服务器外部进行配置;
* 提供服务器管理接口;
* 提供服务器监视日志
* 支持快速的索引增长升级和快照发布



看到这里,真想和Solr来个亲密接触呀。

另外,Solr有一个非常有意思的功能,支持 IndexUpdateListener ,这可是我梦寐以求的呀。

详情见这里:关于 IndexUpdateListener 的讨论

相关阅读:

中文分词和二元分词综合对比

关于lucene发展和多语言实现的方向

xajax0.5beta发布了(今天刚看到)

,

Yipee! It's now available for download here:

http://prdownloads.sourceforge.net/xaja … p?download

Read the release notes that come with the download; they're fairly detailed. Those, the latest tests files, and the inline documentation should help you get started. We'll be updating a bunch of stuff on the wiki soon.

Be sure to check out the official 0.5 Beta 1 thread in the General xajax Discussion forum. Enjoy!

Jared


http://community.xajaxproject.org/viewtopic.php?id=2287

PHP5的web服务

,

PHP5中使用Web服务访问J2EE应用程序
http://www.yesky.com/185/1933185.shtml

Nusoap
也不错。首页还有个pdf

常用的curl

,

function http_get($url,$header=array("Content-Type: text/xml;charset=utf-8"))
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}

function http_post($url,$params,$xml_post = true)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POST, 1);
if($xml_post) curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}

终于能够通过phpmailer使用gmail账号发送邮件了

, ,

原文联接: http://www.fwolf.com/blog/post/155

终于能够通过phpmailer使用gmail账号发送邮件了
授权方式:署名,非商业用途,保持一致,转载时请务必以超链接(http://www.fwolf.com/blog/post/155)的形式标明文章原始出处和作者信息及本声明。
phpmailer(现在的版本是1.73)是一个很好用的工具,可以很方便的使用php语言发送邮件,支持smtp及验证,我们一直都用它。

但是,由于gmail的smtp采用了ssl连接:

Outgoing Mail (SMTP) Server - requires TLS: smtp.gmail.com (use authentication)
Use Authentication: Yes
Use STARTTLS: Yes (some clients call this SSL)
Port: 465 or 587
使用phpmailer就无法正常连接gmail的发信服务器了,并且这个问题一直没有得到phpmailer的官方解决,不过在sf.net上面的讨论里倒是找到了一点资料,采用下面这种方法就可以连接gmail了。

修改class.smtp.php,第101行,把

$this->smtp_conn = fsockopen($host, # the host of the server
改成

$this->smtp_conn = fsockopen(’ssl://’ . $host, # the host of the server
这样就可以了,就是指定使用ssl协议连接主机,当然php的openssl模块必须打开:

extension=php_openssl.dll
但是这样就不能使用非ssl的主机了,我也不像在include目录下面放两份phpmailer,于是,又琢磨出了一种更好的方式:

打开class.phpmailer.php,在大概543行附近,函数SmtpConnect()中,找到:

$this->smtp->do_debug = $this->SMTPDebug;
$hosts = explode(”;”, $this->Host);
$index = 0;
$connection = ($this->smtp->Connected());

// Retry while there is no connection
while($index < count($hosts) && $connection == false)
{
if(strstr($hosts[$index], ":"))
list($host, $port) = explode(":", $hosts[$index]);
else
{
$host = $hosts[$index];
$port = $this->Port;
}

这一段的部分功能就是,如果你输入的主机名中带有端口号,自动的识别出来,设想虽好,但就是这部分让我们无法直接在调用的时候使用ssl格式的主机名,因为“ssl://xxx”的形式会被误认为是主机:端口号的形式,另外端口号一般都比较固定,我们手工设置好了,也不必一定要和主机一起赋值,所以在上面的代码后面添加:

//Modify by Fwolf @ 2006-4-14, to enable ssl mail connection
$host = $this->Host;
$port = $this->Port;
就可以了,使用正常smtp主机的时候,用法不变,使用gmail的时候,使用ssl://smtp.gmail.com作为主机名就可以了,唯一稍微麻烦一些的就是端口需要手工指定——其实也不麻烦。

按照上面的配置更改后,使用gmail账号发送邮件时还会有一条警告信息:

Warning: fgets(): SSL: fatal protocol error in H:\php_includes\phpmailer_ssl\cla
ss.smtp.php on line 1024
这各警告信息在php的帮助里面有,好像是在使用ssl连接的时候,读文件读到文件尾的时候出现的问题,需要手工屏蔽,或者人为控制读的长度,我们用最简单的方式禁止警告信息显示就可以了,找到class.smtp.php的1024行,在fgets($this->smtp_conn,515)函数前面加上个@就可以了。

下面是一个完整的使用phpmailer发送邮件的函数:

function send_mail($to_address, $to_name ,$subject, $body, $attach = ‘’)
{
//使用phpmailer发送邮件
require_once(”phpmailer/class.phpmailer.php”);
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->CharSet = ‘utf-8′;
$mail->Encoding = ‘base64′;
$mail->From = ‘fwolf.mailagent@gmail.com’;
$mail->FromName = ‘Fwolf’;
//$mail->Sender = ‘fwolf.mailagent@gmail.com’;
//$mail->ConfirmReadingTo = ‘fwolf.mailagent@gmail.com’; //回执?

$mail->Host = ’ssl://smtp.gmail.com’;
$mail->Port = 465; //default is 25, gmail is 465 or 587
$mail->SMTPAuth = true;
$mail->Username = “fwolf.mailagent@gmail.com”;
$mail->Password = “xxx”;

$mail->>ddAddress($to_address, $to_name);
//$mail->AddReplyTo(’fwolf.aide@gmail.com’, “Fwolf”); //针对gmail无用,gmail是In-Reply-To:,phpmailer默认生成的是Reply-to:
$mail->WordWrap = 50;
if (!empty($attach))
$mail->AddAttachment($attach);
$mail->IsHTML(false);
$mail->Subject = $subject;
$mail->Body = $body;
//$mail->AltBody = “This is the body in plain text for non-HTML mail clients”;

if(!$mail->Send())
{
echo “Mail send failed.\r\n”;
echo “Error message: ” . $mail->ErrorInfo . “\r\n”;
return false;
}
else
{
echo(”Send $attach to $to_name <$to_address> successed.\r\n”);
return true;
}
//echo “Message has been sent”;
//
}
January 2010
S M T W T F S
December 2009February 2010
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30