Misc. indexing fixes

This commit is contained in:
Yorhel 2016-11-20 16:41:08 +01:00
parent 46a6e2ff7c
commit de28175cd3
3 changed files with 10 additions and 3 deletions

View file

@ -102,11 +102,17 @@ fn insert_man_row(tr: &postgres::GenericConnection, verid: i32, path: &str, enc:
fn insert_man(tr: &postgres::GenericConnection, verid: i32, paths: &[&str], ent: &mut Read) { fn insert_man(tr: &postgres::GenericConnection, verid: i32, paths: &[&str], ent: &mut Read) {
let (dig, enc, cont) = match man::decode(paths, ent) { let (dig, enc, mut cont) = match man::decode(paths, ent) {
Err(e) => { error!("Error decoding {}: {}", paths[0], e); return }, Err(e) => { error!("Error decoding {}: {}", paths[0], e); return },
Ok(x) => x, Ok(x) => x,
}; };
// Postgres doesn't like the 0-byte in UTF-8 (and rightly so).
if cont.contains(0 as char) {
warn!("Removing 0-byte in man page contents");
cont = cont.replace(0 as char, "");
}
// Overwrite entry if the contents are different. It's possible that earlier decoding // Overwrite entry if the contents are different. It's possible that earlier decoding
// implementations didn't properly detect the encoding. (On the other hand, due to differences // implementations didn't properly detect the encoding. (On the other hand, due to differences
// in filenames it's also possible that THIS decoding step went wrong, but that's slightly less // in filenames it's also possible that THIS decoding step went wrong, but that's slightly less

View file

@ -1,4 +1,4 @@
test -f .config && source .config test -f .config && source ./.config
index() { index() {

View file

@ -74,5 +74,6 @@ case "$1" in
;; ;;
all) all)
$0 old $0 old
$0 active $0 current
;;
esac esac