这是我想要索引和搜索的Json文档
{
"BookName":"Book1",
"ISBN":"978-3-16-148410-0",
"PageCount":"504",
"Chapters":{
"Chapter1":"Chapter_Content",
"Chapter2":"Chapter_Content",
"Chapter3":"Chapter_Content",
"Chapter4":"Chapter_Content",
"Chapter5":"Chapter_Content",
"Chapter6":"Chapter_Content",
...
"ChapterN":"Chapter_Content"
}
}
{
"BookName":"Book2",
"ISBN":"548-1-13-344410-1",
"PageCount":"504",
"Chapters":{
"Chapter1":"Chapter_Content",
"Chapter2":"Chapter_Content",
"Chapter3":"Chapter_Content",
...
"ChapterN":"Chapter_Content"
}
}
我想从这些文档中检索章节号,就像我搜索任何章节内容一样它应该返回ChapterName(第1章,第2章......)
{
"BookName":"Book1",
"ISBN":"978-3-16-148410-0",
"PageCount":"504",
"Chapters":{
"Chapter1":"This textbook was written with two primary objectives. The first is to introduce...",
"Chapter2":"C is a general-purpose programming language, and is used for writing programs in many different domains, such as ...",
"Chapter3":"The following program is the traditional first program presented in introductory C courses and textbooks...",
"Chapter4":"The following program produces identical output to the previous example. It shows ...",
"Chapter5":"This text is organised in a sequential fashion—from fundamentals to higher-level constructs and software design issues. The core language is covered in Chapters 2–5 and...",
"Chapter6":"Identifiers (i.e., variable names, function names, etc) are made up of letters and digits, and are case-sensitive. The first ...",
...
"ChapterN":"Other Content..."
}
}
现在在json上面如果我搜索传统,它应该返回第3章 或者,如果我搜索区分大小写,则应返回第6章。
- 示例结束 -
我尝试过突出显示方法,但使用突出显示我必须存储数据,这会增加索引的大小,根据我的映射,我已从源中排除了章节字段。
有没有更好的解决方案?
提前致谢!