Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nnjcy-data-model
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljb
nnjcy-data-model
Commits
1f38df53
Commit
1f38df53
authored
Jan 17, 2024
by
wqc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
演示切换原来的接口
parent
7cef3cbe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
93 deletions
+91
-93
doc-server/src/main/java/com/zq/doc/controller/DocController.java
+86
-87
doc-server/src/main/java/com/zq/doc/vo/AplhaDocVo.java
+5
-6
No files found.
doc-server/src/main/java/com/zq/doc/controller/DocController.java
View file @
1f38df53
...
@@ -46,84 +46,11 @@ public class DocController {
...
@@ -46,84 +46,11 @@ public class DocController {
*
*
* @return
* @return
*/
*/
// @GetMapping("/db/search")
@GetMapping
(
"/db/search"
)
// @ApiOperation("数据库综合查询: 在综合查询中, 有按条件查询, 条件过滤, 排序, 分页, 高亮显示, 获取部分域信息")
// public SolrDocumentPage dbSearch(@ApiParam("页码") @RequestParam(defaultValue = "1") Integer pageNum,
// @ApiParam("每页记录数") @RequestParam(defaultValue = "10") Integer pageSize,
// @ApiParam("查询条件") AplhaDocVo aplhaDocVo) throws SolrServerException, IOException {
// SolrQuery params = new SolrQuery();
// //查询条件, 这里的 q 对应 下面图片标红的地方
// if (StringUtils.isBlank(aplhaDocVo.getAjnr())) {
// params.set("q", "*");
// } else {
// params.set("q", aplhaDocVo.getAjnr());
// }
//
// if (StringUtils.isNotEmpty(aplhaDocVo.getAh())) {
// params.addFilterQuery("ah:*" + aplhaDocVo.getAh() + "*");
// }
// if (ObjectUtil.isNotNull(aplhaDocVo.getAjmc())) {
// params.addFilterQuery("ajmc:*" + aplhaDocVo.getAjmc() + "*");
// }
// if (StringUtils.isNotBlank(aplhaDocVo.getFymc())) {
// params.addFilterQuery("fymc:*" + aplhaDocVo.getFymc() + "*");
// }
// if (StringUtils.isNotBlank(aplhaDocVo.getAy())) {
// params.addFilterQuery("ay:*" + aplhaDocVo.getAy() + "*");
// }
// if (ObjectUtil.isNotNull(aplhaDocVo.getAjnr())) {
// params.addFilterQuery("ajnr:*" + aplhaDocVo.getAjnr() + "*");
// }
//
// //排序
// params.addSort("id", SolrQuery.ORDER.desc);
// //分页
// params.setStart((pageNum - 1) * pageSize);
// params.setRows(pageSize);
// //默认域
// params.set("df", "keyword");
// //高亮打开开关
// params.setHighlight(true);
// //指定高亮域
// params.addHighlightField("ajnr");
//
// //设置前缀
// params.setHighlightSimplePre("<span style='color:red'>");
// //设置后缀
// params.setHighlightSimplePost("</span>");
//
// QueryResponse queryResponse = client.query(core, params);
//
// SolrDocumentList results = queryResponse.getResults();
//
// long numFound = results.getNumFound(); // 查询到的结果
//
// //获取高亮显示的结果, 高亮显示的结果和查询结果是分开放的
// Map<String, Map<String, List<String>>> highlight = queryResponse.getHighlighting();
//
// for (SolrDocument result : results) { // 将高亮结果合并到查询结果中
// result.remove("keyword");
// highlight.forEach((k, v) -> {
// if (result.get("id").equals(k)) {
// v.forEach((k1, v1) -> {
// if (!k1.equals("keyword")) result.setField(k1, v1); // 高亮列合并如结果
// });
// }
// });
// }
// return new SolrDocumentPage(pageNum, pageSize, numFound, results);
// }
/**
* 综合查询: 在综合查询中, 有按条件查询, 条件过滤, 排序, 分页, 高亮显示, 获取部分域信息
*
* @return
*/
@GetMapping
(
"/db/search/new"
)
@ApiOperation
(
"数据库综合查询: 在综合查询中, 有按条件查询, 条件过滤, 排序, 分页, 高亮显示, 获取部分域信息"
)
@ApiOperation
(
"数据库综合查询: 在综合查询中, 有按条件查询, 条件过滤, 排序, 分页, 高亮显示, 获取部分域信息"
)
public
SolrDocumentPage
dbSearch
New
(
@ApiParam
(
"页码"
)
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
public
SolrDocumentPage
dbSearch
(
@ApiParam
(
"页码"
)
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@ApiParam
(
"每页记录数"
)
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
,
@ApiParam
(
"每页记录数"
)
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
,
@ApiParam
(
"查询条件"
)
AplhaDocVo
aplhaDocVo
)
throws
SolrServerException
,
IOException
{
@ApiParam
(
"查询条件"
)
AplhaDocVo
aplhaDocVo
)
throws
SolrServerException
,
IOException
{
SolrQuery
params
=
new
SolrQuery
();
SolrQuery
params
=
new
SolrQuery
();
//查询条件, 这里的 q 对应 下面图片标红的地方
//查询条件, 这里的 q 对应 下面图片标红的地方
if
(
StringUtils
.
isBlank
(
aplhaDocVo
.
getAjnr
()))
{
if
(
StringUtils
.
isBlank
(
aplhaDocVo
.
getAjnr
()))
{
...
@@ -132,21 +59,24 @@ public class DocController {
...
@@ -132,21 +59,24 @@ public class DocController {
params
.
set
(
"q"
,
aplhaDocVo
.
getAjnr
());
params
.
set
(
"q"
,
aplhaDocVo
.
getAjnr
());
}
}
if
(
aplhaDocVo
.
getFymc
().
size
()
>
0
){
params
.
addFilterQuery
(
"fymc:"
+
StrUtil
.
join
(
" OR fymc:"
,
aplhaDocVo
.
getFymc
()));
}
if
(
aplhaDocVo
.
getAy
().
size
()
>
0
){
params
.
addFilterQuery
(
"ay:"
+
StrUtil
.
join
(
" OR ay:"
,
aplhaDocVo
.
getAy
()));
}
if
(
StringUtils
.
isNotEmpty
(
aplhaDocVo
.
getAh
()))
{
if
(
StringUtils
.
isNotEmpty
(
aplhaDocVo
.
getAh
()))
{
params
.
addFilterQuery
(
"ah:*"
+
aplhaDocVo
.
getAh
()
+
"*"
);
params
.
addFilterQuery
(
"ah:*"
+
aplhaDocVo
.
getAh
()
+
"*"
);
}
}
if
(
ObjectUtil
.
isNotNull
(
aplhaDocVo
.
getAjmc
()))
{
if
(
ObjectUtil
.
isNotNull
(
aplhaDocVo
.
getAjmc
()))
{
params
.
addFilterQuery
(
"ajmc:*"
+
aplhaDocVo
.
getAjmc
()
+
"*"
);
params
.
addFilterQuery
(
"ajmc:*"
+
aplhaDocVo
.
getAjmc
()
+
"*"
);
}
}
if
(
StringUtils
.
isNotBlank
(
aplhaDocVo
.
getFymc
()))
{
params
.
addFilterQuery
(
"fymc:*"
+
aplhaDocVo
.
getFymc
()
+
"*"
);
}
if
(
StringUtils
.
isNotBlank
(
aplhaDocVo
.
getAy
()))
{
params
.
addFilterQuery
(
"ay:*"
+
aplhaDocVo
.
getAy
()
+
"*"
);
}
if
(
ObjectUtil
.
isNotNull
(
aplhaDocVo
.
getAjnr
()))
{
params
.
addFilterQuery
(
"ajnr:*"
+
aplhaDocVo
.
getAjnr
()
+
"*"
);
}
//排序
params
.
addSort
(
"id"
,
SolrQuery
.
ORDER
.
desc
);
//分页
//分页
params
.
setStart
((
pageNum
-
1
)
*
pageSize
);
params
.
setStart
((
pageNum
-
1
)
*
pageSize
);
params
.
setRows
(
pageSize
);
params
.
setRows
(
pageSize
);
...
@@ -163,7 +93,9 @@ public class DocController {
...
@@ -163,7 +93,9 @@ public class DocController {
params
.
setHighlightSimplePost
(
"</span>"
);
params
.
setHighlightSimplePost
(
"</span>"
);
QueryResponse
queryResponse
=
client
.
query
(
core
,
params
);
QueryResponse
queryResponse
=
client
.
query
(
core
,
params
);
SolrDocumentList
results
=
queryResponse
.
getResults
();
SolrDocumentList
results
=
queryResponse
.
getResults
();
long
numFound
=
results
.
getNumFound
();
// 查询到的结果
long
numFound
=
results
.
getNumFound
();
// 查询到的结果
//获取高亮显示的结果, 高亮显示的结果和查询结果是分开放的
//获取高亮显示的结果, 高亮显示的结果和查询结果是分开放的
...
@@ -182,6 +114,74 @@ public class DocController {
...
@@ -182,6 +114,74 @@ public class DocController {
return
new
SolrDocumentPage
(
pageNum
,
pageSize
,
numFound
,
results
);
return
new
SolrDocumentPage
(
pageNum
,
pageSize
,
numFound
,
results
);
}
}
// /**
// * 综合查询: 在综合查询中, 有按条件查询, 条件过滤, 排序, 分页, 高亮显示, 获取部分域信息
// *
// * @return
// */
// @GetMapping("/db/search/new")
// @ApiOperation("数据库综合查询: 在综合查询中, 有按条件查询, 条件过滤, 排序, 分页, 高亮显示, 获取部分域信息")
// public SolrDocumentPage dbSearchNew(@ApiParam("页码") @RequestParam(defaultValue = "1") Integer pageNum,
// @ApiParam("每页记录数") @RequestParam(defaultValue = "10") Integer pageSize,
// @ApiParam("查询条件") AplhaDocVo aplhaDocVo) throws SolrServerException, IOException {
// SolrQuery params = new SolrQuery();
// //查询条件, 这里的 q 对应 下面图片标红的地方
// if (StringUtils.isBlank(aplhaDocVo.getAjnr())) {
// params.set("q", "*");
// } else {
// params.set("q", aplhaDocVo.getAjnr());
// }
//
// if(aplhaDocVo.getFymc().size() > 0){
// params.addFilterQuery("fymc:" + StrUtil.join(" OR fymc:", aplhaDocVo.getFymc()));
// }
//
// if(aplhaDocVo.getAy().size() > 0){
// params.addFilterQuery("ay:" + StrUtil.join(" OR ay:", aplhaDocVo.getAy()));
// }
//
// if (StringUtils.isNotEmpty(aplhaDocVo.getAh())) {
// params.addFilterQuery("ah:*" + aplhaDocVo.getAh() + "*");
// }
// if (ObjectUtil.isNotNull(aplhaDocVo.getAjmc())) {
// params.addFilterQuery("ajmc:*" + aplhaDocVo.getAjmc() + "*");
// }
//
// //分页
// params.setStart((pageNum - 1) * pageSize);
// params.setRows(pageSize);
// //默认域
// params.set("df", "keyword");
// //高亮打开开关
// params.setHighlight(true);
// //指定高亮域
// params.addHighlightField("ajnr");
//
// //设置前缀
// params.setHighlightSimplePre("<span style='color:red'>");
// //设置后缀
// params.setHighlightSimplePost("</span>");
//
// QueryResponse queryResponse = client.query(core, params);
// SolrDocumentList results = queryResponse.getResults();
// long numFound = results.getNumFound(); // 查询到的结果
//
// //获取高亮显示的结果, 高亮显示的结果和查询结果是分开放的
// Map<String, Map<String, List<String>>> highlight = queryResponse.getHighlighting();
//
// for (SolrDocument result : results) { // 将高亮结果合并到查询结果中
// result.remove("keyword");
// highlight.forEach((k, v) -> {
// if (result.get("id").equals(k)) {
// v.forEach((k1, v1) -> {
// if (!k1.equals("keyword")) result.setField(k1, v1); // 高亮列合并如结果
// });
// }
// });
// }
// return new SolrDocumentPage(pageNum, pageSize, numFound, results);
// }
@GetMapping
(
"/ay"
)
@GetMapping
(
"/ay"
)
public
ResultVo
ay
(){
public
ResultVo
ay
(){
return
ResultVo
.
success
(
new
ArrayList
<>());
return
ResultVo
.
success
(
new
ArrayList
<>());
...
@@ -196,4 +196,4 @@ public class DocController {
...
@@ -196,4 +196,4 @@ public class DocController {
public
ResultVo
getById
(
@PathVariable
(
"id"
)
Long
id
){
public
ResultVo
getById
(
@PathVariable
(
"id"
)
Long
id
){
return
ResultVo
.
success
(
ajxxFileMapper
.
selectById
(
id
));
return
ResultVo
.
success
(
ajxxFileMapper
.
selectById
(
id
));
}
}
}
}
\ No newline at end of file
doc-server/src/main/java/com/zq/doc/vo/AplhaDocVo.java
View file @
1f38df53
...
@@ -30,13 +30,13 @@ public class AplhaDocVo {
...
@@ -30,13 +30,13 @@ public class AplhaDocVo {
/**
/**
* 法院名称
* 法院名称
*/
*/
private
List
<
String
>
fymc
;
private
String
fymc
;
// private List<String> fymc;
/**
/**
* 案由
* 案由
*/
*/
private
List
<
String
>
ay
;
//
private List<String> ay;
private
String
ay
;
/**
/**
* 案件内容
* 案件内容
*/
*/
...
@@ -46,4 +46,4 @@ public class AplhaDocVo {
...
@@ -46,4 +46,4 @@ public class AplhaDocVo {
* 裁判时间
* 裁判时间
*/
*/
private
Date
time
;
private
Date
time
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment