- /* Bug 2878: Check and add Truncation */
- if (checkForLeftTruncation(apt->attributes))
- wrbuf_puts(w, "*");
- /* BUG 4415: Escape : (as \:) in string terms */
- for (i = 0 ; i < lterm; i++) {
- if (sterm[i] == ':') {
- wrbuf_putc(w, '\\');
- }
- wrbuf_putc(w, sterm[i]);
- }
- /* Bug 2878: Check and add Truncation */
- if (checkForRightTruncation(apt->attributes))
+ for (i = 0 ; i < lterm; i++)
+ {
+ if (sterm[i] == '\\' && i < lterm - 1)
+ {
+ i++;
+ if (strchr(SOLR_SPECIAL, sterm[i]))
+ wrbuf_putc(w, '\\');
+ wrbuf_putc(w, sterm[i]);
+ }
+ else if (sterm[i] == '?' && trunc == 104)
+ {
+ wrbuf_putc(w, '*');
+ }
+ else if (sterm[i] == '#' && trunc == 104)
+ {
+ wrbuf_putc(w, '?');
+ }
+ else if (strchr(SOLR_SPECIAL, sterm[i]))
+ {
+ wrbuf_putc(w, '\\');
+ wrbuf_putc(w, sterm[i]);
+ }
+ else
+ wrbuf_putc(w, sterm[i]);
+ }
+ if (trunc == 1)