}
.paragraphs-container.mui--text-body1, .paragraphs-container.mui--text-body2{
font-size: 1.8rem;
line-height: 35px;
}
.book-modal{
width: 100%;
height: 100%;
padding: 40px10%;
box-sizing: border-box;
margin: 0auto;
background-color: white;
overflow-y: scroll;
position: fixed;
top: 0;
left: 0;
}
.pagination-panel{
display: flex;
justify-content: space-between;
}
.title-row{
display: flex;
justify-content: space-between;
align-items: flex-end;
}
@ media(max-width: 600px) {
.title-row{
flex-direction: column;
text-align: center;
align-items: center
}
}
.locations-label{
text-align: center;
margin: 8px;
}
.modal-footer{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
display: flex;
justify-content: space-around;
background: white;
}
7.3 测试
打开localhost:8080,应该能够看到一个简单分页返回结果。此时可以键入一些关键词进行查询测试。

这一步不需要重新运行docker-compose up命令使修改生效。本地public目录直接挂载在Ngnix服务器容器中,因此前端本地系统数据改变直接反应在容器化应用中。
如果点任一个输出,没什么效果,意味着还有一些功能需要添加进应用中。
8. 页面检查
最好点击任何一个输出,可以查出上下文来自哪本书。
8.0 添加Elasticsearch查询
首先,需要定义一个从给定书中获得段落的简单查询。在server/search.js下的module.exports中加入如下内容:
/** Get the specified range of paragraphs from a book */
getParagraphs (bookTitle, startLocation, endLocation) {
constfilter = [
{ term: { title: bookTitle } },
{ range: { location: { gte: startLocation, lte: endLocation } } }
]
constbody = {
size: endLocation - startLocation,
sort: { location: 'asc'},
query: { bool: { filter } }
}
returnclient.search({ index, type, body })
}
此功能将返回给定书排序后的段落。
8.1 添加API服务端口
本节将把上节功能链接到API服务端口。在server/app.js中原来的/search服务端口下添加如下内容:
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-88488-16.html
美国的帮手会越来越少
你还骂人家