Re: solr 4.3 solrj generating search terms that return no results
Thanks Shawn! That makes sense now. I appreciate the response. -- View this message in context: http://lucene.472066.n3.nabble.com/solr-4-3-solrj-generating-search-terms-that-return-no-results-tp4077137p4099615.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: solr 4.3 solrj generating search terms that return no results
I'm having the same issue with solrJ 4.5.1 If I use the escapeQueryChars() function on a string like a b c it is escaping it to a\+b\+c which returns 0 results using edismax query parser. However a b c returns results. -- View this message in context: http://lucene.472066.n3.nabble.com/solr-4-3-solrj-generating-search-terms-that-return-no-results-tp4077137p4099524.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: solr 4.3 solrj generating search terms that return no results
On 11/5/2013 9:41 PM, dboychuck wrote: I'm having the same issue with solrJ 4.5.1 If I use the escapeQueryChars() function on a string like a b c it is escaping it to a\+b\+c which returns 0 results using edismax query parser. However a b c returns results. A space is a special character to the Solr query parser. It is a term delimiter. This means that if you are escaping all special characters, you have to escape the space. If you do not want the *entire* string treated as a single term for the query parser, then you cannot use escapeQueryChars. You'll need to write your own code that is aware of the specific special characters that you want to escape. Thanks, Shawn
Re: solr 4.3 solrj generating search terms that return no results
On 11/5/2013 10:22 PM, Shawn Heisey wrote: If you do not want the *entire* string treated as a single term for the query parser, then you cannot use escapeQueryChars. You'll need to write your own code that is aware of the specific special characters that you want to escape. If your query is already available in pieces rather than just a string that the user types in, you could do something like the following. I don't imagine that this level of object detail would be available, though: String escTerm1 = ClientUtils.escapeQueryChars(term1); String escTerm2 = ClientUtils.escapeQueryChars(term2); String escTerm3 = ClientUtils.escapeQueryChars(term3); String queryStr = escTerm1 + + escTerm2 + + escTerm3; solrQuery.setQuery(queryStr); Thanks, Shawn
solr 4.3 solrj generating search terms that return no results
I'm having trouble with solrj generating a query like q=kohler%5C+k for the search term 'Kohler k' I am using Solr 4.3 in cloud mode. When I remove the %5C everything is fine. I'm not sure why the %5C is being added when I call solrQuery.setQuery('Kohler k'); Any help is appreciated. -- View this message in context: http://lucene.472066.n3.nabble.com/solr-4-3-solrj-generating-search-terms-that-return-no-results-tp4077137.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: solr 4.3 solrj generating search terms that return no results
On 7/10/2013 6:34 PM, dboychuck wrote: I'm having trouble with solrj generating a query like q=kohler%5C+k for the search term 'Kohler k' I am using Solr 4.3 in cloud mode. When I remove the %5C everything is fine. I'm not sure why the %5C is being added when I call solrQuery.setQuery('Kohler k'); Any help is appreciated. %5C is a backslash. In order for a space to be a literal part of a query string and not a tokenization point, it must be escaped, and the character for doing that is a backslash. I would not have expected this to be added, though. I am in the process of building a test app to try this. Can you use http://apaste.info to share more of your solrj code? I should also be on IRC momentarily. Thanks, Shawn
Re: solr 4.3 solrj generating search terms that return no results
solrQuery.setQuery(ClientUtils.escapeQueryChars(keyword)); It looks like using the solrj ClientUtils.escapeQueryChars function is escaping any spaces with %5C+ which returns 0 results at search time. -- View this message in context: http://lucene.472066.n3.nabble.com/solr-4-3-solrj-generating-search-terms-that-return-no-results-tp4077137p4077141.html Sent from the Solr - User mailing list archive at Nabble.com.