导读:
做一个搜索引擎就要像个样子,做的专业一些才好,因此在分页处理时也采用类似百度和google的分页方式。
对于结果集的处理,大家各有办法,总结起来就是缓存和重新查询两种方式,lucene推荐第二种,如果使用缓存的方式感觉控制资源的释放比较困难,在并发性较多的情况下系统可能资源耗尽,因此我们这里采用lucene推荐的做法实现类似百度和google的分页效果。
终于调试通过了,大家可以直接使用了,哪里不清楚可以给我留言。
//初始化全局变量
int totalNum = 0; //总共记录条数
int numPerPage = 0; //每页显示记录条数
int maxPageNum = 0; //本次搜索最大页数
int curPage = 1; //当前页
int startLocation = 0; //起始位置
Vector searchresult = (Vector) session.getAttribute("searchresult");
numPerPage = ((Integer)session.getAttribute("setPageNum")).intValue();
totalNum = searchresult.size();
maxPageNum=((totalNum%numPerPage) == 0)?totalNum/numPerPage:(totalNum/numPerPage+1);
curPage=startLocation/numPerPage + 1;
%> //初始化全局变量
int totalNum = 0; //总共记录条数
int numPerPage = 0; //每页显示记录条数
int maxPageNum = 0; //本次搜索最大页数
int curPage = 1; //当前页
int startLocation = 0; //起始位置
Vector searchresult = (Vector) session.getAttribute("searchresult");
numPerPage = ((Integer)session.getAttribute("setPageNum")).intValue();
totalNum = searchresult.size();
maxPageNum=((totalNum%numPerPage) == 0)?totalNum/numPerPage:(totalNum/numPerPage+1);
curPage=startLocation/numPerPage + 1;
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
分享到:
相关推荐
在lucene搜索分页过程中,可以有两种方式 一种是将搜索结果集直接放到session中,但是假如结果集非常大,同时又存在大并发访问的时候,很可能造成服务器的内存不足,而使服务器宕机 还有一种是每次都重新进行搜索,这样...
SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part3 SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part2 SSH + Lucene + 分页 + 排序 + 高亮 ...
lucene的排序过滤和分页,lucene开发技术,lucene下载
SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part3 SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part2 SSH + Lucene + 分页 + 排序 + 高亮 ...
利用Lucene.net做的建立索引,检索分页
一步一步跟我学习lucene是对近期做lucene索引的总结,大家有问题的话联系本人如蒙加入,不胜感激,大家共同探讨,本人争取每日一博,希望大家持续关注,会带给大家惊喜的
这个是自己写的lucene分页高亮程序虽然有些不足但是毕竟是自己研究半天总结出来的麻烦各位帮忙给点分哈哈祝大家新年快乐!
SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎
SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part3 SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part2 SSH + Lucene + 分页 + 排序 + 高亮 ...
SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part3 SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part2 SSH + Lucene + 分页 + 排序 + 高亮 ...
SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part3 SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part2 SSH + Lucene + 分页 + 排序 + 高亮 ...
SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part3 SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎--NewsWithSearch.part2 SSH + Lucene + 分页 + 排序 + 高亮 ...
NULL 博文链接:https://iamyida.iteye.com/blog/2193345
lucene实例是一个比较详细的例子,包括lucene的入门到高级实例,代码里有比较详细的实例,所有的实例都是通过junit来测试...实例包括各种搜索:如通配符查询、模糊查询、查询结果的分页、中文分词器、自定义分词器等...
NULL 博文链接:https://llying.iteye.com/blog/581411
springmvc+mybatis+lucene4文档搜索系统(支持分页)
包括 lucene.net 介绍, lucene.net工作模式, lucene.net分词方法和中文分词方法, lucene.net索引的建立详解, lucene.net搜索详解, lucene.net的下载方法, lucene.net搜索结果实现分页。
NULL 博文链接:https://huyana-town.iteye.com/blog/2197476
赠送jar包:lucene-spatial3d-6.6.0.jar; 赠送原API文档:lucene-spatial3d-6.6.0-javadoc.jar; 赠送源代码:lucene-spatial3d-6.6.0-sources.jar; 赠送Maven依赖信息文件:lucene-spatial3d-6.6.0.pom; 包含...