You have to escape all special characters. Even [ to \[ Have a look here http://lucene.apache.org/java/2_4_0/queryparsersyntax.html
Uwe 2009/7/1 Ben <b...@autonomic.net> > I only just noticed that this is an exception being thrown by the > lucene.queryParser. Should I be mailing on the lucene list, or is it ok > here? > > I'm beginning to wonder if the "fq" can handle the type of character > exclusion I'm trying in the RegExp. > Escaping the string also doesn't work : > > Cannot parse 'vector:_\*[\^_\]\*_[\^_\]\*_[\^_\]\*': Encountered "]" at > line 1, column 15. > Was expecting one of: > "TO" ... > <RANGEIN_QUOTED> ... > <RANGEIN_GOOP> ... > > Ben wrote: > >> >> Ben wrote: >> >>> The exception SOLR raises is : >>> >>> org.apache.lucene.queryParser.ParseException: Cannot parse >>> 'vector:_*[^_]*_[^_]*_[^_]*': Encountered "]" at line 1, column 12. >>> Was expecting one of: >>> "TO" ... >>> <RANGEIN_QUOTED> ... >>> <RANGEIN_GOOP> ... >>> Ben wrote: >>> >>>> Passing in a RegularExpression like "[^_]*_[^_]*" (e.g. matching >>>> anything with an underscore in the string) using some code like : >>>> >>>> ... >>>> parameters.add("fq", "vector:[^_]*_[^_]*"); >>>> ... >>>> >>>> seems to cause problems for SOLR, I assume because of the [ or ^ >>>> character. >>>> >>>> Can somebody please advise how to handle character exclusion in such >>>> searches? >>>> >>>> Any help or pointers are much appreciated! >>>> >>>> Thanks >>>> >>>> Ben >>>> >>> >>> >> >