review feedback
This commit is contained in:
parent
cda906d7b8
commit
b4325199cf
|
@ -38,7 +38,7 @@ public interface ISearchDao extends JpaRepository<Search, Long> {
|
||||||
Optional<Search> findByUuidAndFetchIncludes(@Param("uuid") String theUuid);
|
Optional<Search> findByUuidAndFetchIncludes(@Param("uuid") String theUuid);
|
||||||
|
|
||||||
@Query("SELECT s.myId FROM Search s WHERE (s.myCreated < :cutoff) AND (s.myExpiryOrNull IS NULL OR s.myExpiryOrNull < :now)")
|
@Query("SELECT s.myId FROM Search s WHERE (s.myCreated < :cutoff) AND (s.myExpiryOrNull IS NULL OR s.myExpiryOrNull < :now)")
|
||||||
Slice<Long> findWhereLastReturnedBefore(@Param("cutoff") Date theCutoff, @Param("now") Date theNow, Pageable thePage);
|
Slice<Long> findWhereCreatedBefore(@Param("cutoff") Date theCutoff, @Param("now") Date theNow, Pageable thePage);
|
||||||
|
|
||||||
@Query("SELECT s FROM Search s WHERE s.myResourceType = :type AND mySearchQueryStringHash = :hash AND (s.myCreated > :cutoff) AND s.myDeleted = false AND s.myStatus <> 'FAILED'")
|
@Query("SELECT s FROM Search s WHERE s.myResourceType = :type AND mySearchQueryStringHash = :hash AND (s.myCreated > :cutoff) AND s.myDeleted = false AND s.myStatus <> 'FAILED'")
|
||||||
Collection<Search> findWithCutoffOrExpiry(@Param("type") String theResourceType, @Param("hash") int theHashCode, @Param("cutoff") Date theCreatedCutoff);
|
Collection<Search> findWithCutoffOrExpiry(@Param("type") String theResourceType, @Param("hash") int theHashCode, @Param("cutoff") Date theCreatedCutoff);
|
||||||
|
|
|
@ -42,7 +42,8 @@ import static org.apache.commons.lang3.StringUtils.left;
|
||||||
@Table(name = "HFJ_SEARCH", uniqueConstraints = {
|
@Table(name = "HFJ_SEARCH", uniqueConstraints = {
|
||||||
@UniqueConstraint(name = "IDX_SEARCH_UUID", columnNames = "SEARCH_UUID")
|
@UniqueConstraint(name = "IDX_SEARCH_UUID", columnNames = "SEARCH_UUID")
|
||||||
}, indexes = {
|
}, indexes = {
|
||||||
@Index(name = "IDX_SEARCH_RESTYPE_HASHS", columnList = "RESOURCE_TYPE,SEARCH_QUERY_STRING_HASH,CREATED")
|
@Index(name = "IDX_SEARCH_RESTYPE_HASHS", columnList = "RESOURCE_TYPE,SEARCH_QUERY_STRING_HASH,CREATED"),
|
||||||
|
@Index(name = "IDX_SEARCH_CREATED", columnList = "CREATED")
|
||||||
})
|
})
|
||||||
public class Search implements ICachedSearchDetails, Serializable {
|
public class Search implements ICachedSearchDetails, Serializable {
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class DatabaseSearchCacheSvcImpl implements ISearchCacheSvc {
|
||||||
|
|
||||||
TransactionTemplate tt = new TransactionTemplate(myTxManager);
|
TransactionTemplate tt = new TransactionTemplate(myTxManager);
|
||||||
final Slice<Long> toDelete = tt.execute(theStatus ->
|
final Slice<Long> toDelete = tt.execute(theStatus ->
|
||||||
mySearchDao.findWhereLastReturnedBefore(cutoff, new Date(), PageRequest.of(0, 2000))
|
mySearchDao.findWhereCreatedBefore(cutoff, new Date(), PageRequest.of(0, 2000))
|
||||||
);
|
);
|
||||||
assert toDelete != null;
|
assert toDelete != null;
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
||||||
Builder.BuilderWithTableName searchTable = version.onTable("HFJ_SEARCH");
|
Builder.BuilderWithTableName searchTable = version.onTable("HFJ_SEARCH");
|
||||||
searchTable.dropIndex("20200203.1", "IDX_SEARCH_LASTRETURNED");
|
searchTable.dropIndex("20200203.1", "IDX_SEARCH_LASTRETURNED");
|
||||||
searchTable.dropColumn("20200203.2", "SEARCH_LAST_RETURNED");
|
searchTable.dropColumn("20200203.2", "SEARCH_LAST_RETURNED");
|
||||||
|
searchTable.addIndex("20200203.3", "IDX_SEARCH_CREATED").unique(false).withColumns("CREATED");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void init410() { // 20190815 - 20191014
|
protected void init410() { // 20190815 - 20191014
|
||||||
|
|
Loading…
Reference in New Issue