spring-boot - 如何在 solr 的多值字段中搜索并将结果映射到多值字段中?
问题描述
我正在使用 solr 4.10.3 并在多值字段上执行搜索操作。我的数据如下所示 -
"id": 1234567,
"type": "Standard",
"headline": [
"horlics",
"horlics new",
"horlics new test"
],
"headline_string": [
"horlics",
"horlics new",
"horlics new test"
]
我必须对标题执行搜索,并且我正在使用以下代码 -
GroupOptions groupOptions = new GroupOptions().addGroupByField(field);
query.addProjectionOnField("headline_string");
query.setGroupOptions(groupOptions);
query.setPageRequest(page);
return solrTemplate.queryForGroupPage(query, MyClass.class);
但它给出了“不能在多值字段上使用 FieldCache”的错误。
我也尝试使用 FacetQuery -
FacetQuery facetQuery = new SimpleFacetQuery(new Criteria("headline").contains("new"));
FacetOptions facetOptions = new FacetOptions();
facetQuery.setFacetOptions(facetOptions.addFacetOnField(s).setPageable(page));
FacetPage<MyClass> facetPage = solrTemplate.queryForFacetPage(facetQuery, MyClass.class);
这给了我所有与我的标准不匹配的结果。欢迎任何建议。
谢谢。
解决方案
推荐阅读
- spartacus-storefront - 斯巴达克斯全球面包屑嵌套层次结构
- java - 如何在列表视图中的 LongclickListener 上的变量中存储 Hashmap 值?
- android-studio - Gradle 是否包含在 Android Studio 中?
- javascript - 如何将文本框验证为指定模式
- swift - Swift:泛型重载,“更专业”的定义
- rust - 错误[E0658]:`cfg(doctest)` 是实验性的,可能会发生变化
- botframework - 加载包失败 提供的插件包不理解。验证提交的文件是有效的 Office 加载项包
- python - 使用字典映射python中的特定值
- html - Boostrap 4 响应式卡片组等高卡片页脚
- angular - RxJs - 结合两个 observables,结果选择器函数,zip