• 大小: 21.12MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-27
  • 语言: Java
  • 标签: Lucene  

资源简介

传智播客Java就业班视频的代码。Lucene项目(华电内部文档搜索系统) 可以根据关键字搜索文档中包含该关键字的pfd文档和word文档

资源截图

代码片段和文件信息

package com.beifeng.sooba.action;

import java.net.URLEncoder;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.beifeng.sooba.search.AdvanceGetSearcheResult;
import com.beifeng.sooba.search.DocumentEntity;
import com.beifeng.sooba.search.GetSearcheResult;
import com.beifeng.sooba.util.PageNumBean;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class AdvanceSearchAction extends ActionSupport{



@Override
public String execute() throws Exception {
// System.out.println(this.fieldname);
// System.out.println(this.qtype);
// System.out.println(this.pagetype);
// System.out.println(this.totalpage);
// System.out.println(this.filetype);


      

HttpServletRequest request = ServletActionContext.getRequest();



int currentNum=1;
AdvanceGetSearcheResult gsr=new AdvanceGetSearcheResult(this.pagetypethis.filetypethis.qtypethis.fieldnamethis.totalpage);
List list=gsr.getResult(1);
int recordCount=gsr.getScoreDocs().length;
System.out.println(“----advance-- ---“+list.size()+“-------------“);
PageNumBean pageBean=null;
System.out.println(“------ “+recordCount);
pageBean=(PageNumBean)request.getAttribute(“pageNumBean“);
if(pageBean==null){
pageBean=new PageNumBean(1recordCountthis.pagetypethis.pagetype);
request.setAttribute(“pageNumBean“ pageBean);
}
    
Integer downPageNum =currentNum+1;
if(downPageNum>pageBean.getPageCount())downPageNum=null;
Integer upPageNum =currentNum-1;
if(upPageNum==0)upPageNum=null;
pageBean.setUpPageNum(upPageNum);
pageBean.setDownPageNum(downPageNum);
pageBean.setCurrentNum(currentNum);
request.setAttribute(“pageNumBean“ pageBean);
request.setAttribute(“sk“this.fieldname);
request.setAttribute(“sk1“URLEncoder.encode(fieldname“UTF-8“));
ActionContext.getContext().getSession().put(“pageUrl““SearchAction.action?page=“);
ActionContext.getContext().getSession().put(“rsize“recordCount);
ActionContext.getContext().getSession().put(“rlist“list);


return SUCCESS;

}
private String fieldname;
private String qtype;
private int pagetype;
private int totalpage;
private String filetype;
public String getFieldname() {
return fieldname;
}
public void setFieldname(String fieldname) {
this.fieldname = fieldname;
}
public String getQtype() {
return qtype;
}
public void setQtype(String qtype) {
this.qtype = qtype;
}
public int getPagetype() {
return pagetype;
}
public void setPagetype(int pagetype) {
this.pagetype = pagetype;
}
public int getTotalpage() {
return totalpage;
}
public void setTotalpage(int totalpage) {
this.totalpage = totalpage;
}
public String getFiletype() {
return filetype;
}
public void setFiletype(String filetype) {
this.filetype = filetype;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6365  2009-10-13 00:56  sooba\.classpath

     文件        288  2009-11-04 08:53  sooba\.mymetadata

     文件       1431  2009-10-05 22:02  sooba\.project

     文件        467  2009-10-05 16:32  sooba\.springBeans

     文件       3114  2009-10-23 15:20  sooba\soobauml.umr

     文件       1576  2009-10-16 14:59  sooba\src\applicationContext.xml

     文件       3008  2009-11-11 15:08  sooba\src\com\beifeng\sooba\action\AdvanceSearchAction.java

     文件       2702  2009-11-05 21:17  sooba\src\com\beifeng\sooba\action\DeleteSearch.java

     文件        778  2009-11-09 18:54  sooba\src\com\beifeng\sooba\action\DoDeleteAction.java

     文件       1663  2009-11-06 21:44  sooba\src\com\beifeng\sooba\action\FileIndexAction.java

     文件       1260  2009-10-23 15:03  sooba\src\com\beifeng\sooba\action\LoginAction.java

     文件       2713  2009-11-06 22:06  sooba\src\com\beifeng\sooba\action\MainSearch.java

     文件       1031  2009-11-09 16:59  sooba\src\com\beifeng\sooba\biz\DelDocumentAndRecord.java

     文件        119  2009-10-16 14:34  sooba\src\com\beifeng\sooba\db\admin\AdminDao.java

     文件        479  2009-10-16 14:57  sooba\src\com\beifeng\sooba\db\admin\AdminDaoImpl.java

     文件        137  2009-10-18 21:38  sooba\src\com\beifeng\sooba\db\admin\maps\db.txt

     文件        451  2009-10-16 13:29  sooba\src\com\beifeng\sooba\db\admin\maps\User.xml

     文件        500  2009-10-16 13:22  sooba\src\com\beifeng\sooba\db\admin\User.java

     文件        708  2009-10-29 19:48  sooba\src\com\beifeng\sooba\db\DocRecord.java

     文件        310  2009-11-06 21:37  sooba\src\com\beifeng\sooba\db\DocRecordDao.java

     文件       1078  2009-11-06 21:39  sooba\src\com\beifeng\sooba\db\DocRecordDaoImpl.java

     文件        169  2009-10-30 17:05  sooba\src\com\beifeng\sooba\db\maps\db.txt

     文件       1564  2009-11-06 21:39  sooba\src\com\beifeng\sooba\db\maps\DocRecord.xml

     文件       1061  2009-10-23 15:18  sooba\src\com\beifeng\sooba\filter\AdminFilter.java

     文件        958  2009-10-06 22:03  sooba\src\com\beifeng\sooba\filter\CharEncodingFileter.java

     文件       1342  2009-10-06 11:07  sooba\src\com\beifeng\sooba\parserpdf\XpdfParams.java

     文件       2453  2009-11-03 16:33  sooba\src\com\beifeng\sooba\parserpdf\XpdfParser.java

     文件       5776  2009-11-11 14:55  sooba\src\com\beifeng\sooba\search\AdvanceGetSearcheResult.java

     文件        925  2009-11-04 20:16  sooba\src\com\beifeng\sooba\search\DocumentEntity.java

     文件       4664  2009-11-06 00:23  sooba\src\com\beifeng\sooba\search\GetSearcheResult.java

............此处省略447个文件信息

评论

共有 条评论