前歴が長くてすみません。私は非常に一般的なケースを持っています(私の考えでは)。私のスキーマで私が持っていることを想像してみましょう:
<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"/>
通常、フィールド内のみで検索したいと思いsearch_field
ます。しかし、私はこのフィールドをクライアントとの間でサーバーとの間で送受信しませんでした。
SolrJ でこれを作成する方法は知っていますが、現在、Spring Data Solr を使用してすべてのメリットを享受したいと考えています。
だから私はクラスを次のように宣言します:
public class Product {
@Field private String id;
@Field private String title;
@Field private String description;
}
次のような単純なリポジトリ:
public interface SolrRepository extends SolrCrudRepository<Product, String> {
Page<Product> findByTitle(String title, Pageable page);
}
非常にうまく機能します。しかし。メソッドを書きたい:
Page<Product> findBySearchField(String text, Pageable page);
しかし、これはもちろん機能しません。
これはうまくいくはずだと思います:
@Query(value = "search_field:?0")
FacetPage<Product> findByPopularityFacetOnName(String text, Pageable page);
しかし、これを行うための別のオプション(およびより良いオプション)はありますか?
私の英語で申し訳ありませんが、訂正してください - ようこそ!