mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-05-31 22:44:34 +00:00
Search: Include pages with scores of 10,000 or less
This commit is contained in:
parent
ea3cb238fd
commit
efae8aff51
@ -74,7 +74,14 @@ public class Percentile_rng {
|
|||||||
private void Rng_len_(boolean first) {
|
private void Rng_len_(boolean first) {
|
||||||
score_end = score_bgn + (first ? 1 : 0); // + 1 to include rows with scores at max; EX: > 999,998 AND < 1,000,001
|
score_end = score_bgn + (first ? 1 : 0); // + 1 to include rows with scores at max; EX: > 999,998 AND < 1,000,001
|
||||||
score_bgn = score_end - score_len;
|
score_bgn = score_end - score_len;
|
||||||
if (score_bgn < 0) score_bgn = 0; // make sure score is not negative
|
|
||||||
|
// note that score_bgn will be first to go negative; EX: (2,000 : 12,000) -> (-8,000 : 2,000) -> (0 : 2,000) -> search still run for 0 - 2000; DATE:2017-04-24
|
||||||
|
if (score_bgn < 0)
|
||||||
|
score_bgn = 0;
|
||||||
|
|
||||||
|
// note that score_end will go to 0 only at end of lookup; EX: (0 : 2,000) -> (-10,000 : -8,000) -> (0 : 0) -> search will not be run; DATE:2017-04-24
|
||||||
|
if (score_end < 0)
|
||||||
|
score_end = 0;
|
||||||
}
|
}
|
||||||
@gplx.Internal protected static int Calc_score_unit(int total_needed, long total_max, int score_max) {// TEST:
|
@gplx.Internal protected static int Calc_score_unit(int total_needed, long total_max, int score_max) {// TEST:
|
||||||
int rv = (int)Math_.Ceil(Math_.Div_safe_as_double(total_needed, Math_.Div_safe_as_double(total_max, score_max))); // EX: 100 needed / (16 M / 1 M) -> 7 units to fill 100
|
int rv = (int)Math_.Ceil(Math_.Div_safe_as_double(total_needed, Math_.Div_safe_as_double(total_max, score_max))); // EX: 100 needed / (16 M / 1 M) -> 7 units to fill 100
|
||||||
|
@ -35,7 +35,7 @@ public abstract class Percentile_select_base { // SELECT * FROM x ORDER BY y LIM
|
|||||||
rdr = Rdr__term(rdr);
|
rdr = Rdr__term(rdr);
|
||||||
Rng__update(rdr_found);
|
Rng__update(rdr_found);
|
||||||
boolean found_enough = Found_enough();
|
boolean found_enough = Found_enough();
|
||||||
boolean none_left = rng.Score_bgn() == 0;
|
boolean none_left = rng.Score_end() == 0; // search is done when score_end == 0; note that this is set in Percentile_rng; DATE:2017-04-24
|
||||||
Rdr__done(found_enough, none_left);
|
Rdr__done(found_enough, none_left);
|
||||||
if (found_enough || none_left)
|
if (found_enough || none_left)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user