Java 映射';可忽略的';要在Spring数据中使用的solr中的字段

Java 映射';可忽略的';要在Spring数据中使用的solr中的字段,java,spring,solr,spring-data,spring-data-solr,Java,Spring,Solr,Spring Data,Spring Data Solr,对漫长的史前历史感到抱歉。我(脑子里)有一个很常见的例子。让我们想象在我的模式中我有: <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> <field name="title" type="text_general" indexed="true" stored="true" multiValued="false"/> <

对漫长的史前历史感到抱歉。我(脑子里)有一个很常见的例子。让我们想象在我的模式中我有:

<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
<field name="title" type="text_general" indexed="true" stored="true" multiValued="false"/>
<field name="description" type="text_general" indexed="true" stored="false" multiValued="false"/>
.....
<field name="search_field" type="text_general" indexed="true" stored="false" multiValued="true"/>

<copyField source="title" dest="search_field"/>
<copyField source="..." dest="search_field"/>
<copyField source="description" dest="search_field"/>
简单的存储库,如:

public interface SolrRepository extends SolrCrudRepository<Product, String> {
    Page<Product> findByTitle(String title, Pageable page);
}
公共接口SolrRepository扩展了SolrCrude存储库{
页面FindBytle(字符串标题,可分页页面);
}
效果很好。但是我想写一个方法:

Page<Product> findBySearchField(String text, Pageable page);
Page findBySearchField(字符串文本,可分页页面);
但这当然不行

我认为这应该是可行的:

@Query(value = "search_field:?0")
FacetPage<Product> findByPopularityFacetOnName(String text, Pageable page);
@Query(value=“search\u字段:?0”)
FacetPage findByPopularityFacetOnName(字符串文本,可分页页面);
但是,是否还有其他选择(以及更好的选择)可以做到这一点


对不起,我的英语,任何更正-欢迎

在我看来,这是一条路要走<代码>搜索_字段未映射,但它存在,因此访问它的方法是给定要执行的特定查询

除此之外,您的方法需要注释如下,以使其结果基于
search\u字段
search和facet on name:

@Facet(fields = "name")
@Query(value = "search_field:?0")
FacetPage<Product> findByPopularityFacetOnName(String text, Pageable page);
@Facet(fields=“name”)
@查询(value=“搜索字段:?0”)
FacetPage findByPopularityFacetOnName(字符串文本,可分页页面);
@Facet(fields = "name")
@Query(value = "search_field:?0")
FacetPage<Product> findByPopularityFacetOnName(String text, Pageable page);