Hi Ian,
I'll assume this actually did get indexed as a single token, so there is no
problem there.
As for query string escaping, perhaps this method from Lucene's QueryParser
will help:
/**
* Returns a String where those characters that QueryParser
* expects to be escaped are escaped by a preceding <code>\</code>.
*/
public static String escape(String s) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
// These characters are part of the query syntax and must be escaped
if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')'
|| c == ':'
|| c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c ==
'}' || c == '~'
|| c == '*' || c == '?' || c == '|' || c == '&') {
sb.append('\\');
}
sb.append(c);
}
return sb.toString();
}
Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
________________________________
From: Ian Connor <[email protected]>
To: solr <[email protected]>
Sent: Tuesday, February 10, 2009 9:28:11 PM
Subject: Is there a way to query for this value?
I have tried to escape the characters as best I can, but cannot seem to find
one that works.
The value is:
10.1002/(SICI)1096-9136(199604)13:4<390::AID-DIA121>3.0.CO;2-4
It is a doi (see http://doi.org), so is a valid value to search on. However,
when I query this through ruby or even the admin interface, the parser does
not like it and returns an error.
What is the way to escape this? Is there such code for ruby?
--
Regards,
Ian Connor