简体   繁体   English

如何在spring-data-solr中使用带有方法名称的get前缀?

[英]How to use get prefix with method name in spring-data-solr?

There are lot of examples for findBy prefix but i couldn't find any example or document for how to use get prefix with method name to get the all 'address' fields from solr. 有很多findBy前缀的示例,但是我找不到任何示例或文档来了解如何使用带有方法名称的get前缀从solr获取所有“地址”字段。 This is my Dao class 这是我的道课

@Repository
public interface CarDao extends SolrCrudRepository<House,String> {

    Page<CarModel>findByNameContainsIgnoreCaseAndConditionAndCountry(String name,String condition,String country, Pageable pageable);


    List<String> getAddress();
}

Any help ? 有什么帮助吗?

You can use fields attribute in @Query annotation on getAddress method to get the required fields. 您可以在getAddress方法的@Query批注中使用fields属性来获取必填字段。

@Query(fields={"address"}, value="YOUR_QUERY")
List<String> getAddress();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM