package com.ruoyi.novel.service.impl;

// NovelSearchService.java
@Service
public class NovelSearchServiceImpl implements NovelSearchService {

    @Autowired
    private ElasticsearchRestTemplate elasticTemplate;

    public List<Novel> searchNovels(String keyword) {
        NativeSearchQuery query = new NativeSearchQueryBuilder()
                .withQuery(QueryBuilders.multiMatchQuery(keyword, "title", "author", "description"))
                .build();
        return elasticTemplate.search(query, Novel.class).getContent();
    }
}
