Hi Jérôme: Thanks for your suggestion Jérôme, I'll do as you told me for allowing the search of this specific tokens. I've also taked into account the option of add the "quote if lenght is 1" in the application level, but I would like to keep this logic inside of Solr (if possible), this is why I was thinking of some kind of replace regular expresion at query time, so if this change in the future it won't require also changing the application level, can you advice me on this?
Greetings! ----- Mensaje original ----- De: "Jérôme Étévé" <jerome.et...@gmail.com> Para: solr-user@lucene.apache.org Enviados: Martes, 23 de Abril 2013 10:44:39 Asunto: Re: Querying only for "+" character causes org.apache.lucene.queryParser.ParseException If you want to allow your users to search for '+' , you also define your '+' as being a regular ALPHA characters: In config: delimiter_types.txt: # # We let +, # and * be part of normal words. # This is to let c++, c#, c* and R&D as words. # + => ALPHA # => ALPHA * => ALPHA & => ALPHA @ => ALPHA Then in your solr.WordDelimiterFilterFactory, use types="delimiter_types.txt" You'll then be able to let your users search for + as part of a word. If you want to allow them to search for just '+' , a little hacking is necessary in your client code. Personally, I just double quote the query if it's only one char length. Can't be harmful and as it will turn your single + into "+" , it will be considered as a token (rather than being part of the query syntax) by the parser. Providing you're using the edismax parser, it should be just fine for any other queries, like '+ foo' , 'foo +', '++' ... J. On 23 April 2013 15:09, Jorge Luis Betancourt Gonzalez <jlbetanco...@uci.cu>wrote: > Hi Kai: > > Thanks for your reply, for what I've understood this logic must be > included in my application, It would be possible to, for instance, use some > regular expression at querying time in my schema to avoid a query that > contains only this characters? for instance + and +++++ would be a good > catch to avoid. > > Thanks in advance! > > ----- Mensaje original ----- > De: "Kai Becker" <m...@kai-becker.com> > Para: solr-user@lucene.apache.org > Enviados: Martes, 23 de Abril 2013 9:48:26 > Asunto: Re: Querying only for "+" character causes > org.apache.lucene.queryParser.ParseException > > Hi, > > you need to escape that char in search terms. > Special chars are + - ! ( ) { } [ ] ^ " ~ * ? : \ / at the moment. > > The %2B is just the url encoding, but it will still be a + for Solr, so > just put a \ in front of the chars I mentioned. > > Cheers, > Kai > > Am 23.04.2013 um 15:41 schrieb Jorge Luis Betancourt Gonzalez: > > > Hi! > > > > Currently I'm working on a basica search engine for, the main problem is > that during some tests a problem was detected, in the application if a user > search for the "+" or "-" term only or the "+++++" string it causes an > exception in my application, the problem is caused for an > org.apache.lucene.queryParser.ParseException in solr. I get the same > response if, from the solr admin interface, I search for the + term. For > what I've seen the "+" character gets encoded into "%2B" which cause the > exception. Is there any way of escaping this character so they behave like > any other character? or at least get no response for this cases? > > > > I'm using solr 3.6.2, deployed in tomcat7. > > > > Greetings! > > http://www.uci.cu > > http://www.uci.cu > http://www.uci.cu > -- Jerome Eteve +44(0)7738864546 http://www.eteve.net/ http://www.uci.cu http://www.uci.cu