jplogicv1.0开发开发案例之知识库文档信息索引检索(类仿百度搜索、类google搜索)

来源:互联网 发布:java工程师 职业寿命 编辑:程序博客网 时间:2024/05/17 02:19

基于很多项目中都都可能会使用到针对海量文档信息进行实时检索的需要!对于用户而言比较习惯于百度搜索的使用!本文针对海量文档检索的需求进行描述!针对海量的文档数据我们需要做到最起码两点:1、高效索引  2、高效搜索。当然做到这两点我们需要在我们的项目中完成多道工序,根据索引框架的特点,做相应的优化工作,这样基本上可以完成80%以上的需要,那20%的缺陷可能来自于索引框架本身的局限,比如lucene本身的一些缺点,也可能来自你的编码上的设计。闲话少说,如下是本人针对很多项目中将会使用的一些文档检索的开发案例。开发案例是在jplogic上实现,可移植到其他项目中,如下是海量文档检索功能实现(欢迎进入群【376447127】):

相对简洁的页面(不需要美工额外的设计,每个工程师都可以定制漂亮的界面)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-<span style="color:#ff0000;">transitional</span>.dtd"> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@ taglib uri="/WEB-INF/tagtld/htmlTagComponet.tld" prefix="JB"%><html>  <head>    <style>        html,body {width: 100%;height: 100%;margin: 0px;padding: 0px;overflow: hidden;}    </style>    <JB:ComponentBase id="bomponentBase"  isJudgeSession="true" ></JB:ComponentBase>    <title>全文检索列表</title><script>    var formOperate = new FormOperateObject();  function okOperate(){    closeBlDialog();}    function noOperate(){    closeBlDialog();}//全文检索操作function toolbarall_textOperate(id) {    //搜索按钮if (id == 'all_text_Toolbar4') {var value = $.trim(toolbar_all_text_Toolbar.getValue('all_text_Toolbar2'));if (value == '') {OpenBlDialog('提示','搜索关键字不能为空!','WARN','','','okOperate()','noOperate()','','');} else {var url = 'jsp/JpSystem/doc/DocAllTextQueryResultForm.jsp?queryParam=' +value;url = formOperate.changeURLParamValue(url,'queryParam',value);layout_all_text_layout.cells('a').attachURL(url);}}}</script>  </head><body id="all_text_body" >   <div id="query_result" style="padding:4px;width:99%;height:100%;font-family:'宋体';font-size:50px;overflow:auto;display: none;text-align: center;">   <b>欢迎进入知识库信息检索,输入相应的知识库信息关联的<font color='red'>关键字</font>即可</b>    </div>    <!-- 布局管理器 --><JB:LayoutComponent layoutPattern="1C" parentId="all_text_body" id="all_text_layout" autoReSize="true" isAttachProgress="true">        <!-- 全文操作 -->    <JB:LayoutCellComponent id="abc" layoutCellTitle="全文检索" layoutId="all_text_layout" layoutCellName="a"  embeddedToolbarId="all_text_Toolbar" attachObjectId="query_result"  hiddenHead="false" layoutCellHeigth="600"><JB:ToolBarComponent id="all_text_Toolbar" layoutCellToolbarId="all_text_Toolbar" onclick="toolbarall_textOperate" title="全文检索操作" gridId="">     <JB:ToolBarCellComponent id="all_text_Toolbar" cellType="text" btnSelectName="<b>关键词搜索</b>" imgDisabled="save_dis.gif" imgEnabled="save.gif" itemId="0" optionItems=""></JB:ToolBarCellComponent>    <JB:ToolBarCellComponent id="all_text_Toolbar" cellType="separator" imgDisabled="" imgEnabled=""  itemId="1" optionItems=""></JB:ToolBarCellComponent>    <JB:ToolBarCellComponent id="all_text_Toolbar" cellType="input" btnSelectName="" inputTextWidth="600" imgDisabled="new_dis.gif" imgEnabled="new.gif"  itemId="2" optionItems=""  ></JB:ToolBarCellComponent>    <JB:ToolBarCellComponent id="all_text_Toolbar" cellType="separator" imgDisabled="" imgEnabled=""  itemId="3" optionItems=""></JB:ToolBarCellComponent>    <JB:ToolBarCellComponent id="all_text_Toolbar" cellType="button" btnSelectName="<b>开始检索</b>" imgDisabled="new_dis.gif" imgEnabled="new.gif"  itemId="4" optionItems=""></JB:ToolBarCellComponent></JB:ToolBarComponent></JB:LayoutCellComponent></JB:LayoutComponent>  </body>  </html>

系统界面:

海量文档检索首页

 

知识库资料上传以及追加

检索结果列表

文档预览

文档下载

下载结果

 

0 0
原创粉丝点击