Changed retval to resource id instead of SearchResult in SearchResultDao
This commit is contained in:
parent
35991cd21b
commit
299cf5b230
|
@ -38,8 +38,8 @@ public interface ISearchResultDao extends JpaRepository<SearchResult, Long> {
|
||||||
@Query(value="SELECT r FROM SearchResult r WHERE r.mySearch = :search")
|
@Query(value="SELECT r FROM SearchResult r WHERE r.mySearch = :search")
|
||||||
Collection<SearchResult> findWithSearchUuid(@Param("search") Search theSearch);
|
Collection<SearchResult> findWithSearchUuid(@Param("search") Search theSearch);
|
||||||
|
|
||||||
@Query(value="SELECT r FROM SearchResult r WHERE r.mySearch = :search ORDER BY r.myOrder ASC")
|
@Query(value="SELECT r.myResourcePid FROM SearchResult r WHERE r.mySearch = :search ORDER BY r.myOrder ASC")
|
||||||
Page<SearchResult> findWithSearchUuid(@Param("search") Search theSearch, Pageable thePage);
|
Page<Long> findWithSearchUuid(@Param("search") Search theSearch, Pageable thePage);
|
||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Query(value="DELETE FROM SearchResult r WHERE r.mySearchPid = :search")
|
@Query(value="DELETE FROM SearchResult r WHERE r.mySearchPid = :search")
|
||||||
|
|
|
@ -178,9 +178,9 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
|
||||||
@Override
|
@Override
|
||||||
public List<Long> doInTransaction(TransactionStatus theStatus) {
|
public List<Long> doInTransaction(TransactionStatus theStatus) {
|
||||||
final List<Long> resultPids = new ArrayList<Long>();
|
final List<Long> resultPids = new ArrayList<Long>();
|
||||||
Page<SearchResult> searchResults = mySearchResultDao.findWithSearchUuid(foundSearch, page);
|
Page<Long> searchResultPids = mySearchResultDao.findWithSearchUuid(foundSearch, page);
|
||||||
for (SearchResult next : searchResults) {
|
for (Long next : searchResultPids) {
|
||||||
resultPids.add(next.getResourcePid());
|
resultPids.add(next);
|
||||||
}
|
}
|
||||||
return resultPids;
|
return resultPids;
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,18 +323,18 @@ public class SearchCoordinatorSvcImplTest {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
when(mySearchResultDao.findWithSearchUuid(any(Search.class), any(Pageable.class))).thenAnswer(new Answer<Page<SearchResult>>() {
|
when(mySearchResultDao.findWithSearchUuid(any(Search.class), any(Pageable.class))).thenAnswer(new Answer<Page<Long>>() {
|
||||||
@Override
|
@Override
|
||||||
public Page<SearchResult> answer(InvocationOnMock theInvocation) throws Throwable {
|
public Page<Long> answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
Pageable page = (Pageable) theInvocation.getArguments()[1];
|
Pageable page = (Pageable) theInvocation.getArguments()[1];
|
||||||
|
|
||||||
ArrayList<SearchResult> results = new ArrayList<SearchResult>();
|
ArrayList<Long> results = new ArrayList<Long>();
|
||||||
int max = (page.getPageNumber() * page.getPageSize()) + page.getPageSize();
|
int max = (page.getPageNumber() * page.getPageSize()) + page.getPageSize();
|
||||||
for (int i = page.getOffset(); i < max; i++) {
|
for (int i = page.getOffset(); i < max; i++) {
|
||||||
results.add(new SearchResult().setResourcePid(i + 10L));
|
results.add(i + 10L);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PageImpl<SearchResult>(results);
|
return new PageImpl<Long>(results);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
search.setStatus(SearchStatusEnum.FINISHED);
|
search.setStatus(SearchStatusEnum.FINISHED);
|
||||||
|
|
Loading…
Reference in New Issue