$table cn
where
not deleted
- and (oils_text_as_bytea(upper(label)) > ? or ( cn.id > ? and oils_text_as_bytea(upper(label)) = ? ))
+ and (oils_text_as_bytea(label) > ? or ( cn.id > ? and oils_text_as_bytea(label) = ? ))
and owning_lib in ($orgs)
- order by oils_text_as_bytea(upper(label)), 4, 2
+ order by oils_text_as_bytea(label), 4, 2
limit $size;
SQL
$table cn
where
not deleted
- and (oils_text_as_bytea(upper(label)) < ? or ( cn.id < ? and oils_text_as_bytea(upper(label)) = ? ))
+ and (oils_text_as_bytea(label) < ? or ( cn.id < ? and oils_text_as_bytea(label) = ? ))
and owning_lib in ($orgs)
- order by oils_text_as_bytea(upper(label)) desc, 4 desc, 2 desc
+ order by oils_text_as_bytea(label) desc, 4 desc, 2 desc
limit $size
) as bar
order by 1,4,2;
$table cn
where
not deleted
- and oils_text_as_bytea(upper(label)) < ?
+ and oils_text_as_bytea(label) < ?
and owning_lib in ($orgs)
- order by oils_text_as_bytea(upper(label)) desc, 4 desc, 2 desc
+ order by oils_text_as_bytea(label) desc, 4 desc, 2 desc
limit $topsize
) as bar
order by 1,4,2;
$table cn
where
not deleted
- and oils_text_as_bytea(upper(label)) >= ?
+ and oils_text_as_bytea(label) >= ?
and owning_lib in ($orgs)
- order by oils_text_as_bytea(upper(label)),4,2
+ order by oils_text_as_bytea(label),4,2
limit $bottomsize;
SQL
if ($page <= 0) {
my $before = $_storage->request(
"open-ils.cstore.direct.asset.call_number.search.atomic",
- { label => { "<" => { transform => "upper", value => ["upper", $label] } },
+ { label => { "<" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label] } },
owning_lib => \@ou_ids,
deleted => 'f',
@cp_filter
},
{ flesh => 1,
flesh_fields => { acn => [qw/record owning_lib/] },
- order_by => { acn => "oils_text_as_bytea(label_sortkey) desc, oils_text_as_bytea(upper(label)) desc, id desc, owning_lib desc" },
+ order_by => { acn => "oils_text_as_bytea(label_sortkey) desc, oils_text_as_bytea(label) desc, id desc, owning_lib desc" },
limit => $before_limit,
offset => abs($page) * $page_size - $before_offset,
}
if ($page >= 0) {
my $after = $_storage->request(
"open-ils.cstore.direct.asset.call_number.search.atomic",
- { label => { ">=" => { transform => "upper", value => ["upper", $label] } },
+ { label => { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label] } },
owning_lib => \@ou_ids,
deleted => 'f',
@cp_filter
},
{ flesh => 1,
flesh_fields => { acn => [qw/record owning_lib/] },
- order_by => { acn => "oils_text_as_bytea(label_sortkey), oils_text_as_bytea(upper(label)), id, owning_lib" },
+ order_by => { acn => "oils_text_as_bytea(label_sortkey), oils_text_as_bytea(label), id, owning_lib" },
limit => $after_limit,
offset => abs($page) * $page_size - $after_offset,
}
if ($page < 0) {
my $before = $_storage->request(
"open-ils.cstore.direct.asset.call_number.search.atomic",
- { label => { "<" => { transform => "upper", value => ["upper", $label] } },
+ { label => { "<" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label] } },
owning_lib => \@ou_ids,
deleted => 'f',
@cp_filter
},
{ flesh => 1,
flesh_fields => { acn => [qw/record owning_lib/] },
- order_by => { acn => "oils_text_as_bytea(label_sortkey) desc, oils_text_as_bytea(upper(label)) desc, id desc, owning_lib desc" },
+ order_by => { acn => "oils_text_as_bytea(label_sortkey) desc, oils_text_as_bytea(label) desc, id desc, owning_lib desc" },
limit => $limit,
offset => $offset,
}
if ($page >= 0) {
my $after = $_storage->request(
"open-ils.cstore.direct.asset.call_number.search.atomic",
- { label => { ">=" => { transform => "upper", value => ["upper", $label] } },
+ { label => { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label] } },
owning_lib => \@ou_ids,
deleted => 'f',
@cp_filter
},
{ flesh => 1,
flesh_fields => { acn => [qw/record owning_lib/] },
- order_by => { acn => "oils_text_as_bytea(label_sortkey), oils_text_as_bytea(upper(label)), id, owning_lib" },
+ order_by => { acn => "oils_text_as_bytea(label_sortkey), oils_text_as_bytea(label), id, owning_lib" },
limit => $limit,
offset => $offset,
}
CREATE INDEX asset_call_number_creator_idx ON asset.call_number (creator);
CREATE INDEX asset_call_number_editor_idx ON asset.call_number (editor);
CREATE INDEX asset_call_number_dewey_idx ON asset.call_number (public.call_number_dewey(label));
-CREATE INDEX asset_call_number_upper_label_id_owning_lib_idx ON asset.call_number (oils_text_as_bytea(upper(label)),id,owning_lib);
+CREATE INDEX asset_call_number_upper_label_id_owning_lib_idx ON asset.call_number (oils_text_as_bytea(label),id,owning_lib);
CREATE INDEX asset_call_number_label_sortkey ON asset.call_number(oils_text_as_bytea(label_sortkey));
CREATE UNIQUE INDEX asset_call_number_label_once_per_lib ON asset.call_number (record, owning_lib, label) WHERE deleted = FALSE OR deleted IS FALSE;
CREATE RULE protect_cn_delete AS ON DELETE TO asset.call_number DO INSTEAD UPDATE asset.call_number SET deleted = TRUE WHERE OLD.id = asset.call_number.id;