* lib: do some more escaping of body text
This commit is contained in:
@ -97,9 +97,9 @@ exec guile -e main -s $0 $@
|
|||||||
(define (test-stats)
|
(define (test-stats)
|
||||||
"Test statistical functions."
|
"Test statistical functions."
|
||||||
;; average
|
;; 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))
|
(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:max mu:size) 46230)
|
||||||
(num-equal-or-exit (mu:min mu:size) 111))
|
(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);
|
(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
|
static void
|
||||||
add_terms_values_body (Xapian::Document& doc, MuMsg *msg,
|
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 is allocated on strchunk, no need for freeing */
|
||||||
norm = mu_str_normalize (str, TRUE, strchunk);
|
norm = mu_str_normalize (str, TRUE, strchunk);
|
||||||
|
body_escape_in_place (norm);
|
||||||
|
|
||||||
termgen.index_text_without_positions (norm, 1, prefix(mfid));
|
termgen.index_text_without_positions (norm, 1, prefix(mfid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,3 +11,4 @@ Precedence: high
|
|||||||
The hour of departure has arrived, and we go our ways—I to die, and you to
|
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 ("f:soc@example.com", 1);
|
||||||
search ("t:alki@example.com", 1);
|
search ("t:alki@example.com", 1);
|
||||||
search ("t:alcibiades", 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", 2);
|
||||||
search ("f:soc@example.com OR f:john OR t:edmond", 3);
|
search ("f:soc@example.com OR f:john OR t:edmond", 3);
|
||||||
search ("t:julius", 1);
|
search ("t:julius", 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user