File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed
Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -864,14 +864,14 @@ class Backend @Inject() (implicit
864864 pagination : Option [Pagination ]
865865 ): Future [Intervals ] = {
866866 val tableName = defaultOTSettings.clickhouse.intervals.name
867- val page = pagination.getOrElse(Pagination .mkDefault)
867+ val page = pagination.getOrElse(Pagination .mkDefault).offsetLimit
868868 val intervalsQuery = IntervalsQuery (
869869 chromosome,
870870 start,
871871 end,
872872 tableName,
873- page.index ,
874- page.size
873+ page._1 ,
874+ page._2
875875 )
876876 val total : Int = dbRetriever
877877 .executeQuery[Int , Query ](intervalsQuery.totals)
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ case class IntervalsQuery(chromosome: String,
3636 ),
3737 From (column(tableName)),
3838 positionalQuery,
39- OrderBy (column(" chromosome " ) :: column( " start " ) :: column( " end " ) :: Nil ),
39+ OrderBy (column(" score " ).desc :: Nil ),
4040 Limit (offset, size),
4141 Format (" JSONEachRow" )
4242 )
Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ case class Pagination(index: Int, size: Int) {
2121
2222 def hasValidRange (maxSize : Int = Pagination .sizeMax): Boolean = size <= maxSize
2323
24- val toSQL : String = (index, size) match {
25- case (0 , 0 ) => s " LIMIT ${ Pagination .sizeDefault} "
26- case (0 , s) => s " LIMIT $s "
27- case (i, 0 ) => s " LIMIT ${ i * Pagination .sizeDefault} , ${ Pagination .sizeDefault} "
28- case (i, s) => s " LIMIT ${ i * s} , $s "
29- case null => s " LIMIT ${ Pagination .indexDefault} , ${ Pagination .sizeDefault} "
24+ val offsetLimit : ( Int , Int ) = (index, size) match {
25+ case (0 , 0 ) => ( 0 , Pagination .sizeDefault)
26+ case (0 , s) => ( 0 , s)
27+ case (i, 0 ) => ( i * Pagination .sizeDefault, Pagination .sizeDefault)
28+ case (i, s) => ( i * s, s)
29+ case null => ( 0 , Pagination .sizeDefault)
3030 }
3131
3232 val toES : (Int , Int ) = (index, size) match {
You can’t perform that action at this time.
0 commit comments