[原创]基于apache lucene的mp3搜索器
下面是mp3indexer.java的代码. 【程序编程相关:Drools - 规则引擎可以用了么?】前些日子找机器上的一首老歌时,费了些周折,后想到既然这些mp3有自己的标签信息,为何不利用起来呢?笔者就尝试用lucene实现,分两部分,mp3indexer.java是创建索引的,mp3search.jsp是搜索mp3的页面. 【推荐阅读:第五十三天补: JMS除错笔记】import java.io.*; 【扩展信息:JBoss配置mysql数据源】package mp3indexer;import java.text.*;import java.util.*;import org.apache.lucene.analysis.cjk.*;
import org.apache.lucene.document.*;import org.apache.lucene.index.*;public class mp3indexer
{ public final static string mp3path="d:\\mp3";//mp3所在目录 public final static string indexpath="c:\\mp3indexer";//索引存放目录 public static void main(string[] args) throws classnotfoundexception, ioexception{ try { indexwriter writer = new indexwriter(indexpath, new cjkanalyzer(), true); indexmp3s(writer, new file(mp3path)); ... 下一页