资源简介
lucene文档检索系统,java源码,可执行程序,支持pdf,doc,xls,ppt,html,txt。

代码片段和文件信息
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License Version 2.0
* (the “License“); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.File;
import java.io.FileReader;
import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.htmlparser.*;
import org.htmlparser.visitors.*;
import org.htmlparser.util.*;
import org.apache.pdfbox.*;
import org.apache.pdfbox.pdmodel.*;
import java.io.*;
import org.apache.pdfbox.util.*;
import org.apache.pdfbox.searchengine.lucene.*;
import org.apache.poi.hwpf.extractor.*;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hslf.*;
import org.apache.poi.hslf.model.*;
import org.apache.poi.hssf.usermodel.*;
import java.util.*;
import org.apache.poi.ss.usermodel.*;
/** A utility for making Lucene Documents from a File. */
public class FileDocument {
/** Makes a document for a File.
The document has three fields:
path
--containing the pathname of the file as a stored
untokenized field;
modified
--containing the last modified date of the file as
a field as created by href=“lucene.document.DateTools.html“>DateTools; and
contents
--containing the full contents of the file as a
Reader field;
*/
public static Document Document(File f) throws java.io.
FileNotFoundException {
// make a new empty document
Document doc = new Document();
String[] encoding = {“UTF-8“ “GBK“ “GB2312“ “UTF-8“ “ISO8859_1“};
// Add the path of the file as a field named “path“. Use a field that is
// indexed (i.e. searchable) but don‘t tokenize the field into words.
doc.add(new Field(“path“ f.getPath() Field.Store.YES
Field.Index.NOT_ANALYZED));
// Add the last modified date of the file a field named “modified“. Use
// a field that is indexed (i.e. searchable) but don‘t tokenize the field
// into words.
doc.add(new Field(“modified“
DateTools.timeToString(f.lastModified()
DateTool
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9272335 2009-12-21 23:28 检索课程设计上交内容\可执行程序\InfRetrW2.2.exe
文件 9743 2009-12-13 09:41 检索课程设计上交内容\源代码\FileDocument.java
文件 2359 2009-12-13 08:35 检索课程设计上交内容\源代码\IndexFiles.java
文件 4064 2009-12-13 11:27 检索课程设计上交内容\源代码\LuceneProc.java
文件 17678 2009-12-13 11:03 检索课程设计上交内容\源代码\Mainfr
文件 1070 2009-12-30 21:23 检索课程设计上交内容\源代码\MyTable.java
文件 52736 2009-12-13 11:27 检索课程设计上交内容\设计与说明文档\使用说明文档.doc
文件 35328 2009-12-24 10:15 检索课程设计上交内容\设计与说明文档\程序设计说明书.doc
文件 67584 2009-10-20 10:06 检索课程设计上交内容\设计与说明文档\课程设计要求.doc
目录 0 2009-12-24 10:11 检索课程设计上交内容\可执行程序
目录 0 2009-12-13 11:35 检索课程设计上交内容\源代码
目录 0 2009-12-24 10:15 检索课程设计上交内容\设计与说明文档
目录 0 2009-12-24 10:15 检索课程设计上交内容
----------- --------- ---------- ----- ----
9462897 13
相关资源
- 微博系统(Java源码,servlet+jsp),适
- java串口通信全套完整代码-导入eclip
- 美食天下项目Android版源码和Web版源码
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- u-blox_Android_GNSS_Driver_v3.10驱动源码+中
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- 个人根据Android移动开发案例详解手写
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 基于JSP的学生宿舍管理系统(源码 数
- mysql jsp网站源码下载
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
评论
共有 条评论