没有合适的资源?快使用搜索试试~ 我知道了~
Solrj and Solr and LDAP and SearchEngine
4星 · 超过85%的资源 需积分: 0 5 下载量 192 浏览量
2010-08-13
18:11:37
上传
评论
收藏 25KB DOCX 举报
温馨提示
试读
13页
The following is a sample use of highlighting on a search for Corgan in the artist MusicBrainz data set. Recall that the mb_artists request handler is configured to match against the artist name, alias, and members fields
资源详情
资源评论
资源推荐
Summary of Solr and Solr Related Setting Arnold LI
Solr
Installation
1. Requirement
JDK
2. Download
From apache webside
3. Configuration the fieldType and field
4. paoding(for solve chinese problem)
http://code.google.com/p/paoding/downloads/list
Set paoding home
PAODING_DIC_HOME=/data/paoding/dic
Linux and Windows
5. sample code base on paoding
ChineseTokenizer
package org.apache.fulltextsearch.analizer;
import java.io.IOException;
import java.io.Reader;
import java.util.Iterator;
import net.paoding.analysis.analyzer.TokenCollector;
import net.paoding.analysis.knife.Beef;
import net.paoding.analysis.knife.Collector;
import net.paoding.analysis.knife.Knife;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.Tokenizer;
/**
* Class ChineseTokenizer
* @author Arnold LI
* @Description ChineseTokenizer
*/
public class ChineseTokenizer extends Tokenizer implements Collector
{
private int inputLength;
Page 1
Summary of Solr and Solr Related Setting Arnold LI
private static final int bufferLength = 128;
private final char[] buffer = new char[bufferLength];
private int offset;
private final Beef beef = new Beef(buffer, 0, 0);
private int dissected;
private Knife knife;
private TokenCollector tokenCollector;
@SuppressWarnings("rawtypes")
private Iterator tokenIterator;
public ChineseTokenizer(Reader input, Knife knife,
TokenCollector tokenCollector)
{
this.input = input;
this.knife = knife;
this.tokenCollector = tokenCollector;
}
public void setTokenCollector(TokenCollector tokenCollector)
{
this.tokenCollector = tokenCollector;
}
public void collect(String word, int offset, int end)
{
tokenCollector.collect(word, this.offset + offset,
this.offset + end);
}
public Token next() throws IOException
{
while (tokenIterator == null || !tokenIterator.hasNext())
{
int read = 0;
int remaining = -1;
if (dissected >= beef.length())
{
remaining = 0;
Page 2
Summary of Solr and Solr Related Setting Arnold LI
} else if (dissected < 0)
{
remaining = bufferLength + dissected;
}
if (remaining >= 0)
{
if (remaining > 0)
{
System.arraycopy(buffer, -dissected, buffer, 0,
remaining);
}
read = this.input.read(buffer, remaining,
bufferLength
- remaining);
inputLength += read;
int charCount = remaining = read;
if (charCount < 0)
{
return null;
}
if (charCount < bufferLength)
{
buffer[charCount++] = 0;
}
beef.set(0, charCount);
offset += Math.abs(dissected);
dissected = 0;
}
dissected = knife.dissect((Collector) this, beef,
dissected);
tokenIterator = tokenCollector.iterator();
}
return (Token) tokenIterator.next();
}
public int getInputLength()
{
return inputLength;
Page 3
剩余12页未读,继续阅读
huiyannan
- 粉丝: 1
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1