lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adrianocrest...@apache.org
Subject svn commit: r1495762 - in /lucene/dev/branches/lucene_solr_3_6/lucene/contrib: ./ queryparser/src/java/org/apache/lucene/queryParser/core/builders/ queryparser/src/test/org/apache/lucene/queryParser/core/builders/
Date Sat, 22 Jun 2013 17:51:30 GMT
Author: adrianocrestani
Date: Sat Jun 22 17:51:29 2013
New Revision: 1495762

URL: http://svn.apache.org/r1495762
Log:
applying fix for LUCENE-4890 to branch lucene_solr_3_6

Modified:
    lucene/dev/branches/lucene_solr_3_6/lucene/contrib/CHANGES.txt
    lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java
    lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/builders/TestQueryTreeBuilder.java

Modified: lucene/dev/branches/lucene_solr_3_6/lucene/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_3_6/lucene/contrib/CHANGES.txt?rev=1495762&r1=1495761&r2=1495762&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_3_6/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_3_6/lucene/contrib/CHANGES.txt Sat Jun 22 17:51:29 2013
@@ -5,7 +5,10 @@ http://s.apache.org/luceneversions
 
 ======================= Lucene 3.6.3 =======================
 
-(No Changes)
+Bug Fixes
+
+* LUCENE-4890: QueryTreeBuilder.getBuilder() only finds interfaces on the 
+  most derived class. (Adriano Crestani)
 
 ======================= Lucene 3.6.2 =======================
 

Modified: lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java?rev=1495762&r1=1495761&r2=1495762&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java
(original)
+++ lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java
Sat Jun 22 17:51:29 2013
@@ -157,7 +157,7 @@ public class QueryTreeBuilder implements
         builder = getQueryBuilder(clazz);
 
         if (builder == null) {
-          Class<?>[] classes = node.getClass().getInterfaces();
+          Class<?>[] classes = clazz.getInterfaces();
 
           for (Class<?> actualClass : classes) {
             builder = getQueryBuilder(actualClass);

Modified: lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/builders/TestQueryTreeBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/builders/TestQueryTreeBuilder.java?rev=1495762&r1=1495761&r2=1495762&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/builders/TestQueryTreeBuilder.java
(original)
+++ lucene/dev/branches/lucene_solr_3_6/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/builders/TestQueryTreeBuilder.java
Sat Jun 22 17:51:29 2013
@@ -1,6 +1,6 @@
-package org.apache.lucene.queryParser.core.builders;
+package org.apache.lucene.queryparser.flexible.core.builders;
 
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -20,8 +20,12 @@ package org.apache.lucene.queryParser.co
 import junit.framework.Assert;
 
 import org.apache.lucene.queryParser.core.QueryNodeException;
+import org.apache.lucene.queryParser.core.builders.QueryBuilder;
+import org.apache.lucene.queryParser.core.builders.QueryTreeBuilder;
 import org.apache.lucene.queryParser.core.nodes.FieldQueryNode;
 import org.apache.lucene.queryParser.core.nodes.QueryNode;
+import org.apache.lucene.queryParser.core.nodes.QueryNodeImpl;
+import org.apache.lucene.queryParser.core.parser.EscapeQuerySyntax;
 import org.apache.lucene.queryParser.core.util.UnescapedCharSequence;
 import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Test;
@@ -35,6 +39,27 @@ public class TestQueryTreeBuilder extend
     Object result = qtb.build(new FieldQueryNode(new UnescapedCharSequence("field"), "foo",
0, 0));
     Assert.assertEquals("OK", result);
     
+    // LUCENE-4890
+    qtb = new QueryTreeBuilder();
+    qtb.setBuilder(DummyQueryNodeInterface.class, new DummyBuilder());
+    result = qtb.build(new DummyQueryNode());
+    Assert.assertEquals("OK", result);
+  }
+  
+  private static interface DummyQueryNodeInterface extends QueryNode {
+    
+  }
+  
+  private static abstract class AbstractDummyQueryNode extends QueryNodeImpl implements DummyQueryNodeInterface
{
+    
+  }
+  
+  private static class DummyQueryNode extends AbstractDummyQueryNode {
+
+    public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) {
+      return "DummyQueryNode";
+    }
+    
   }
   
   private static class DummyBuilder implements QueryBuilder {



Mime
View raw message