SOLR-3270 edismax blank q bug

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1304704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Wayne Smiley 2012-03-24 05:06:48 +00:00
parent 6fc8fa052c
commit e0141c7350
2 changed files with 9 additions and 3 deletions

View File

@ -163,7 +163,7 @@ class ExtendedDismaxQParser extends QParser {
parsedUserQuery = null;
String userQuery = getString();
altUserQuery = null;
if( userQuery == null || userQuery.length() < 1 ) {
if( userQuery == null || userQuery.trim().length() == 0 ) {
// If no query is specified, we may have an alternate
String altQ = solrParams.get( DisMaxParams.ALTQ );
if (altQ != null) {

View File

@ -71,8 +71,14 @@ public class TestExtendedDismaxParser extends AbstractSolrTestCase {
String oner = "*[count(//doc)=1]";
String twor = "*[count(//doc)=2]";
String nor = "*[count(//doc)=0]";
assertQ("expected doc is missing (using un-escaped edismax w/qf)",
assertQ("blank q",
req("q"," ",
"q.alt",allq,
"defType","edismax")
,allr);
assertQ("expected doc is missing (using un-escaped edismax w/qf)",
req("q", "literal:colon",
"qf", "t_special",
"defType", "edismax"),