? at beginning of prefixed field

Olly Betts olly at survex.com
Fri Mar 13 00:52:06 GMT 2026


On Fri, Mar 13, 2026 at 12:27:10AM +0000, Olly Betts wrote:
> Curiously I don't see the same thing as you.  For me the prefix isn't
> applied when a wildcard is at the start (which is a bug):
> 
> $ xapian-quest -f default,wildcard_glob -pto:XTO 'to:b?emner'
> Parsed Query: Query(WILDCARD SYNONYM XTOb?emner)
> No database specified so not running the query.
> $ xapian-quest -f default,wildcard_glob -pto:XTO 'to:?remner'
> Parsed Query: Query(WILDCARD SYNONYM ?remner)
> No database specified so not running the query.

What's happening here is that `xapian-quest` loads a stopword list
which includes "to".  It is getting reparsed like for you, but then
"to" gets ignored as a stopword.

I've got a fix, but need to add a regression test before I can push.
If you want to try it, it's just:

--- a/xapian-core/queryparser/queryparser.lemony
+++ b/xapian-core/queryparser/queryparser.lemony
@@ -1480,7 +1480,7 @@ leading_wildcard:
 			}
 		    }
 
-		    if (is_wordchar(ch)) {
+		    if (is_wordchar(ch) || is_extended_wildcard(ch, flags)) {
 			// Prefixed term.
 			it = p;
 		    } else {

Cheers,
    Olly



More information about the Xapian-discuss mailing list