Javascript algolia搜索-高亮显示的属性与片段的属性
我在algoliasearch客户端js中找不到这两个设置之间的差异。 您能否简单地解释一下如何使用这些设置,更重要的是为什么要使用这些设置Javascript algolia搜索-高亮显示的属性与片段的属性,javascript,api,search,algolia,Javascript,Api,Search,Algolia,我在algoliasearch客户端js中找不到这两个设置之间的差异。 您能否简单地解释一下如何使用这些设置,更重要的是为什么要使用这些设置 榜样将是伟大的 attributesToHighlight允许检索属性的完整内容,并使用html标记突出显示匹配的单词 attributesToSnippet提取属性中包含最匹配单词的部分并突出显示它们 例如,如果索引对象是: { "question": "algolia search - attributes to highlight vs attrib
榜样将是伟大的
attributesToHighlight
允许检索属性的完整内容,并使用
html标记突出显示匹配的单词
attributesToSnippet
提取属性中包含最匹配单词的部分并突出显示它们
例如,如果索引对象是:
{ "question": "algolia search - attributes to highlight vs attributes to snippet"}
如果您使用属性突出显示
,您的搜索将类似于:
search("algolia se", {"attributesToHighlight": "question"})
search("algolia se", {"attributesToSnippet": "question:2"})
您将收到以下表格的答复:
{
"question": "algolia search - attributes to high:light vs attributes to snippet",
"_highlightResult": {
"question": {
"value": "<em>algolia</em> </em>se</em>arch - attributes to highlight vs attributes to snippet",
"matchLevel": "full",
"matchedWords": [
"algolia",
"se"
]
}
{
"question": "algolia search - attributes to high:light vs attributes to snippet",
"_snippetResult": {
"question": {
"value": "<em>algolia</em> </em>se</em>arch",
"matchLevel": "full",
"matchedWords": [
"algolia",
"se"
]
}
您将收到以下表格的答复:
{
"question": "algolia search - attributes to high:light vs attributes to snippet",
"_highlightResult": {
"question": {
"value": "<em>algolia</em> </em>se</em>arch - attributes to highlight vs attributes to snippet",
"matchLevel": "full",
"matchedWords": [
"algolia",
"se"
]
}
{
"question": "algolia search - attributes to high:light vs attributes to snippet",
"_snippetResult": {
"question": {
"value": "<em>algolia</em> </em>se</em>arch",
"matchLevel": "full",
"matchedWords": [
"algolia",
"se"
]
}
{
“问题”:“algolia搜索-高属性:轻与片段属性”,
“_snippetResult”:{
“问题”:{
“值”:“algolia搜索”,
“匹配级别”:“完全”,
“匹配词”:[
“阿尔戈利亚”,
“se”
]
}