lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chaiguy1337 <>
Subject Problem with spaces in untokenized field using QueryParser
Date Sat, 06 Dec 2008 03:14:36 GMT

Hi group. I'm having a small problem and couldn't find an obvious explanation
for it anywhere. I'm indexing some textual notes (think sticky notes) via a
standard analyzer. For the most part it's working great, but I'm trying to
implement a tagging feature that allows a note to be tagged with additional

Naturally I do this by adding "tag" fields to the document, one field per
tag, each of which is unique. These are stored, untokenized.

I then use the query parser's colon notation to search for notes based on
tags, e.g. tag:"mytag", and that, too, works great except when there is a
space involved in the tag (it returns zero hits in such cases).
Interestingly the tags are still being indexed because I can search for them

So I'm curious as to why a space is having any effect on the query when I'm
storing the field as untokenized? By the way I'm using syntax like this for
all tags, specifically to allow for spaces in the query:

tag:"my tag"

My QueryParser looks like so:
QueryParser qp = new MultiFieldQueryParser( new string[] { "body", "tag",
"title" }, analyzer );

and 'analyzer' is just a StandardAnalyzer. I'm using a MultiFieldQueryParser
so that by default all three of the mentioned fields are searched when no
field is explicitly indicated. I also experimentally tried replacing spaces
with underscores, but with the same results.

I'd be happy to post more source code if that might help identify the

Thanks in advance for any insights.

View this message in context:
Sent from the Lucene - General mailing list archive at

View raw message