mirror of https://github.com/djcb/mu.git
* lib: do some more escaping of body text
This commit is contained in:
parent
ef1791ec7c
commit
30f93663b0
|
@ -97,9 +97,9 @@ exec guile -e main -s $0 $@
|
|||
(define (test-stats)
|
||||
"Test statistical functions."
|
||||
;; average
|
||||
(num-equal-or-exit (mu:average mu:size) 81709/12)
|
||||
(num-equal-or-exit (mu:average mu:size) 40859/6)
|
||||
(num-equal-or-exit (floor (mu:stddev mu:size))
|
||||
(floor 13414.7101616927))
|
||||
(floor 13413.7101616927))
|
||||
(num-equal-or-exit (mu:max mu:size) 46230)
|
||||
(num-equal-or-exit (mu:min mu:size) 111))
|
||||
|
||||
|
|
|
@ -459,6 +459,19 @@ add_terms_values_attach (Xapian::Document& doc, MuMsg *msg,
|
|||
(MuMsgPartForeachFunc)each_part, &pdata);
|
||||
}
|
||||
|
||||
/* escape the body -- for now, only replace '-' with '_' */
|
||||
static void
|
||||
body_escape_in_place (char *body)
|
||||
{
|
||||
while (*body) {
|
||||
switch (*body) {
|
||||
case '-': *body = '_';
|
||||
default: break;
|
||||
}
|
||||
++body;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_terms_values_body (Xapian::Document& doc, MuMsg *msg,
|
||||
|
@ -482,6 +495,8 @@ add_terms_values_body (Xapian::Document& doc, MuMsg *msg,
|
|||
|
||||
/* norm is allocated on strchunk, no need for freeing */
|
||||
norm = mu_str_normalize (str, TRUE, strchunk);
|
||||
body_escape_in_place (norm);
|
||||
|
||||
termgen.index_text_without_positions (norm, 1, prefix(mfid));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Date: Thu, 31 Jul 2008 14:57:25 -0400
|
||||
From: "Socrates" <soc@example.com>
|
||||
Subject: cool stuff
|
||||
Subject: cool stuff
|
||||
To: "Alcibiades" <alki@example.com>
|
||||
Message-id: <3BE9E6535E0D852173@emss35m06.us.lmco.com>
|
||||
MIME-version: 1.0
|
||||
|
@ -9,5 +9,6 @@ Content-transfer-encoding: 7BIT
|
|||
Precedence: high
|
||||
|
||||
The hour of departure has arrived, and we go our ways—I to die, and you to
|
||||
live. Which is better God only knows.
|
||||
live. Which is better God only knows.
|
||||
|
||||
http-emacs
|
||||
|
|
|
@ -146,6 +146,7 @@ test_mu_find_01 (void)
|
|||
search ("f:soc@example.com", 1);
|
||||
search ("t:alki@example.com", 1);
|
||||
search ("t:alcibiades", 1);
|
||||
search ("http-emacs", 1);
|
||||
search ("f:soc@example.com OR f:john", 2);
|
||||
search ("f:soc@example.com OR f:john OR t:edmond", 3);
|
||||
search ("t:julius", 1);
|
||||
|
|
Loading…
Reference in New Issue