|
|
|
@ -12,6 +12,8 @@ import org.springframework.data.domain.Page;
|
|
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
|
@ -144,7 +146,11 @@ public class JournalSongService {
|
|
|
|
|
if(keyword.length()==1) {
|
|
|
|
|
return searchByLike(keyword,pageRequest);
|
|
|
|
|
}
|
|
|
|
|
return journalSongDao.fuzzySearch("+\""+keyword+"\"", pageRequest.getPageNumber()*pageRequest.getPageSize(), pageRequest.getPageSize());
|
|
|
|
|
List<JournalSong> fullTextFuzzySearchResults = journalSongDao.fuzzySearch("+\""+keyword+"\"", pageRequest.getPageNumber()*pageRequest.getPageSize(), pageRequest.getPageSize());
|
|
|
|
|
if(CollectionUtils.isEmpty(fullTextFuzzySearchResults)) {
|
|
|
|
|
return searchByLike(keyword, pageRequest);
|
|
|
|
|
}
|
|
|
|
|
return fullTextFuzzySearchResults;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<JournalSong> searchByLike(String keyword, PageRequest pageRequest) {
|
|
|
|
|