With SolrJ, you can use ClientUtils.escapeQueryChars(str)
Erik
On Mar 18, 2009, at 7:51 AM, Toby Cole wrote:
You'll need to escape the colon with a backslash, e.g.
fileAbsolutePath:file\:///Volumes/spare/ts/ford/schema/data/news/
fdw2008/jn71796.xml
see the lucene query parser syntax page:
http://lucene.apache.org/java/2_3_2/queryparsersyntax.html#Escaping%20Special%20Characters
Toby.
On 18 Mar 2009, at 11:28, Fergus McMenemie wrote:
Hello
I have a solr field:-
<field name="fileAbsolutePath" type="string" indexed="true"
stored="true" multiValued="false"/>
which an unrelated query reveals is populated with:-
<str name="fileAbsolutePath">
file:///Volumes/spare/ts/ford/schema/data/news/fdw2008/jn71796.xml
</str>
however when I try and query for that exact document explicitly:-
http://localhost:8080/apache-solr-1.4-dev/select?q=fileAbsolutePath:file%3a///Volumes/spare/ts/ford/schema/data/news/fdw2008/jn71796.xml&wt=xml
it fails.
HTTP Status 400 - org.apache.lucene.queryParser.ParseException:
Cannot parse 'fileAbsolutePath:file:///Volumes/spare/ts/ford/schema/data/news/fdw2008/jn71796.xml'
: Encountered " ":" ": "" at line 1, column 21. Was expecting one
of: <EOF> <AND> ... <OR> ... <NOT> ... "+" ... "-" ... "(" ...
"*" ... "^" ... <QUOTED> ... <TERM> ... <FUZZY_SLOP> ...
<PREFIXTERM> ... <WILDTERM> ... "[" ... "{" ... <NUMBER> ...
My encoding did not work! Help!
--
===============================================================
Fergus McMenemie Email:fer...@twig.me.uk
Techmore Ltd Phone:(UK) 07721 376021
Unix/Mac/Intranets Analyst Programmer
===============================================================
Toby Cole
Software Engineer
Semantico
E: toby.c...@semantico.com
W: www.semantico.com