I think you'll have to build the query up in code. RegexQuery in the contrib queries package should be able to take care of #[0-9].
BooleanQuery bq = new BooleanQuery(); PrefixQuery pq = new PrefixQuery(...) // # RegexQuery rq = new RegexQuery(...) // #[0-9] bq.add(pq, ....); bq.add(rq, ...); and search using bq. Or you could extend QueryParser to produce the queries you need. I'd do it the first way. -- Ian. On Wed, Jul 11, 2012 at 5:40 PM, Dave Seltzer <dselt...@tveyes.com> wrote: > Hello, > > I'm interested in searching a MemoryIndex to find occurrences of HashTags. > > To do this I'm trying to use the following query: > #* -#[0 TO 9] > > My goal with this query is to look for any word starting with "#" except > for words like "#1". > > However, when I parse this query, the query parser turns it into this: > +content:#* -content:# +content:[0 TO 9] > > Effectively the QueryParser is splitting up the "#" and the "[0 TO 9]" > > The same behavior occurs when I run this: #* -(#[0 TO 9]) > > Can anyone help me rewrite this query? > > Thanks so much > > -Dave > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org