Sorry for long prehistory. I have very common case (on my mind). Lets imaging that in my schema I have:
<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"/>
Generally I would like to make search on only in search_field
field. But I didn't send this field to/from client from/to server.
I know how to made this with SolrJ, but currently I want to receive all benefits from using Spring Data Solr.
So I declarate class like :
public class Product {
@Field private String id;
@Field private String title;
@Field private String description;
}
Simple Repository like :
public interface SolrRepository extends SolrCrudRepository<Product, String> {
Page<Product> findByTitle(String title, Pageable page);
}
works quite well. BUT. I want to write method:
Page<Product> findBySearchField(String text, Pageable page);
But this doesn't work of course.
I think this should works:
@Query(value = "search_field:?0")
FacetPage<Product> findByPopularityFacetOnName(String text, Pageable page);
But, are there another options(and better options) to do this ?
sorry for my English, any corrections - welcome!