3.6、Lucene文件检索实战 —— 查询界面


1、工程结构

2、index.html 文件

3、效果图

-———————————-

代码仓库:https://gitee.com/carloz/lucene-learn.git

https://gitee.com/carloz/lucene-learn/tree/master/lucene-filesearch

-———————————-

索引构建完成以后,编写index.jsp页面接收用户 关键词。

1、工程结构

2、index.html 文件

对应的css文件,从我的代码仓库中获取

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; ; charset=UTF-8"/>
<title>文件检索</title>
<link type="text/css" rel="stylesheet" href="../css/base.css"/>
<link type="text/css" rel="stylesheet" href="../css/index.css"/>
<link type="text/css" rel="stylesheet" href="../css/moudle_g_search_bar.css"/>
</head>
<body>
<div class="wrap">
<div class="main" class="clearfix">
<div class="header"><br/><br/><br/><br/><br/></div>
<div class="g_search_bar">
<div class="f-large tc">
<h1>文件&nbsp;&nbsp;
<img alt="文件检索" src="images/logo.png" width="70px" height="60px"/>
&nbsp;&nbsp;搜索
</h1>
</div>
<br/>
<div class="tc">
<form class="search_form" style="display: inline-block" action="/search">
<input class="search_text" name="keywords" type="text" />
<input class="btn_submit" type="submit" value="搜索" />
</form>
</div>

</div>
<div class="clear"></div>
</div>
</div>
<div class="footer">
<div class="copyright">
<div>基于Lucene的文件检索系统</div>
<br/>
<div>Copyright ©<strong>CarloZ</strong>&nbsp; All Rights Reversed.</div>
</div>
</div>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package com.learn.lucenefilesearch.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class SearchFileController {

@RequestMapping("/")
public String index() {
return "index";
}
}

3、效果图