On Fri, Jul 15, 2011 at 10:02 AM, Trieu, Jason T <trieu.ja...@con-way.com> wrote: > Hi all, > > I read postings about searching for empty field with but did not find any > cases of successful search using query language syntax itself(-myField:[* TO > *] for example).
We have been using: -myField:* You would need to use setAllowLeadingWildcard on the QueryParser and it wouldn't exactly be fast, but it works for us. The suggestion to use a magic token is a good idea, though I would put it in a separate field called "has" or something... so you can do: has:title (same results as title:* but quicker to run) The crappy thing is that to actually detect if there are any tokens in the field you need to make a TokenStream which can be used to read the first token and then rewind again. I'm not sure if there is such a thing in Lucene at the moment. We had to write it ourselves but we were on a considerably older version at the time. TX --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org