没有SolrDocument类的SolrCrudRepository

时间:2018-09-30 12:25:44

标签: spring-boot solr solrj

Solr存储库类

 @Repository
    public interface PoctestRepository extends SolrCrudRepository<Poctest, String> {
        @Override
        Page<Poctest> findAll(Pageable pageable);

        @Query("id:*?0* OR company:*?0* OR college:*?0* OR name:*?0* OR address:*?0* OR dob:*?0* OR age:*?0*" )
        public Page<Poctest> search(String searchTerm, Pageable pageable);

    }

Solr文档数据类

@SolrDocument(solrCoreName = "poctest")
@Data
public class Poctest {
    @Id
    @Indexed(name = "id", type = "string")
    private String id;

    @Indexed(name = "name", type = "string")
    private String name;

    @Indexed(name = "address", type = "string")
    private String address;

    @Indexed(name = "college", type = "string")
    private String college;

    @Indexed(name = "company", type = "string")
    private String company;

    @Indexed(name = "dob", type = "pint")
    private String dob;

    @Indexed(name = "age", type = "pint")
    private String age;
}

需要澄清:

  1. 是否可以在没有Poctest的情况下从SOLR提取数据(我曾在其中提到solr核心名称)
  2. 在获取数据时我不知道Solr核心名称。它基于用户输入。我的代码应该适用于所有内核,而与预定义内核无关。 如何处理动态SOLR Core? solr核心名称将是REST API的输入。

0 个答案:

没有答案