db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1585315 - in /db/derby/code/trunk/java: optional/org/apache/derby/optional/lucene/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Sun, 06 Apr 2014 16:32:08 GMT
Author: rhillegas
Date: Sun Apr  6 16:32:08 2014
New Revision: 1585315

URL: http://svn.apache.org/r1585315
Log:
DERBY-590: Add a windowSize parameter to the lucene query function; commit derby-590-19-aa-cleanupAPI2.diff.

Modified:
    db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java
    db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCoarseAuthorizationTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCollationTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java

Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java?rev=1585315&r1=1585314&r2=1585315&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java
(original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneQueryVTI.java
Sun Apr  6 16:32:08 2014
@@ -86,6 +86,7 @@ public class LuceneQueryVTI extends Stri
     // constructor args
     private Connection  _connection;
     private String  _queryText;
+    private int         _windowSize;
     private float   _scoreCeiling;
 
     private String      _schema;
@@ -115,6 +116,7 @@ public class LuceneQueryVTI extends Stri
 	LuceneQueryVTI
         (
          String queryText,
+         int    windowSize,
          float scoreCeiling
          )
         throws SQLException
@@ -123,6 +125,7 @@ public class LuceneQueryVTI extends Stri
         
         _connection = LuceneSupport.getDefaultConnection();
         _queryText = queryText;
+        _windowSize = windowSize;
         _scoreCeiling = scoreCeiling;
 	}
 
@@ -431,9 +434,9 @@ public class LuceneQueryVTI extends Stri
 
             QueryParser qp = new QueryParser( LuceneUtils.currentVersion(), TEXT_FIELD_NAME,
analyzer );
             Query luceneQuery = qp.parse( _queryText );
-            TopScoreDocCollector tsdc = TopScoreDocCollector.create(1000, true);
+            TopScoreDocCollector tsdc = TopScoreDocCollector.create( _windowSize, true);
             if ( _scoreCeiling != 0 ) {
-                tsdc = TopScoreDocCollector.create(1000, new ScoreDoc(0, _scoreCeiling ),
true);
+                tsdc = TopScoreDocCollector.create( _windowSize, new ScoreDoc( 0, _scoreCeiling
), true );
             }
             _searcher.search(luceneQuery, tsdc);
             TopDocs topdocs = tsdc.topDocs();

Modified: db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java?rev=1585315&r1=1585314&r2=1585315&view=diff
==============================================================================
--- db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java
(original)
+++ db/derby/code/trunk/java/optional/org/apache/derby/optional/lucene/LuceneSupport.java
Sun Apr  6 16:32:08 2014
@@ -309,11 +309,12 @@ public class LuceneSupport implements Op
 	public static LuceneQueryVTI luceneQuery
         (
          String queryText,
+         int    windowSize,
          float scoreCeiling
          )
         throws ParseException, IOException, SQLException
     {
-		LuceneQueryVTI lqvti = new LuceneQueryVTI( queryText, scoreCeiling );
+		LuceneQueryVTI lqvti = new LuceneQueryVTI( queryText, windowSize, scoreCeiling );
 		return lqvti;
 	}
 	
@@ -482,7 +483,7 @@ public class LuceneSupport implements Op
             
         StringBuilder   tableFunction = new StringBuilder();
         tableFunction.append( "create function " + makeTableFunctionName( schema, table,
textcol ) + "\n" );
-        tableFunction.append( "( query varchar( 32672 ), scoreCeiling real )\n" );
+        tableFunction.append( "( query varchar( 32672 ), windowSize int, scoreCeiling real
)\n" );
         tableFunction.append( "returns table\n(" );
 
         PreparedStatement   ps = null;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCoarseAuthorizationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCoarseAuthorizationTest.java?rev=1585315&r1=1585314&r2=1585315&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCoarseAuthorizationTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCoarseAuthorizationTest.java
Sun Apr  6 16:32:08 2014
@@ -170,7 +170,7 @@ public class LuceneCoarseAuthorizationTe
 
         String  readPoemsIndex =
             "select p.originalAuthor, i.score\n" +
-            "from ruth.poems p, table ( ruth.poems__poemText( 'star', 0 ) ) i\n" +
+            "from ruth.poems p, table ( ruth.poems__poemText( 'star', 1000, 0 ) ) i\n" +
             "where p.poemID = i.poemID and p.versionStamp = i.versionStamp\n" +
             "order by i.score desc\n";
         String[][]  defaultPoemResults =

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCollationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCollationTest.java?rev=1585315&r1=1585314&r2=1585315&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCollationTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCollationTest.java
Sun Apr  6 16:32:08 2014
@@ -150,7 +150,7 @@ public class LuceneCollationTest extends
         assertResults
             (
              conn,
-             "select * from table ( ruth.poems__poemText( 'star', 0 ) ) luceneResults order
by poemID",
+             "select * from table ( ruth.poems__poemText( 'star', 1000, 0 ) ) luceneResults
order by poemID",
              new String[][]
              {
                  { "3", "3", "2", "0.22933942" },

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java?rev=1585315&r1=1585314&r2=1585315&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java
Sun Apr  6 16:32:08 2014
@@ -190,7 +190,7 @@ public class LuceneSupportPermsTest exte
             ( ruthConnection, NONEXISTENT_INDEX, "call LuceneSupport.updateIndex( 'ruth',
'poems', 'originalAuthor', null )" );
 
         // alice can't view an index created by ruth
-        String  viewPoemsIndex = "select * from table ( ruth.poems__poemText( 'star', 0 )
) luceneResults order by poemID";
+        String  viewPoemsIndex = "select * from table ( ruth.poems__poemText( 'star', 1000,
0 ) ) luceneResults order by poemID";
         expectExecutionError( aliceConnection, LACK_EXECUTE_PRIV, viewPoemsIndex );
 
         // but ruth can
@@ -299,7 +299,7 @@ public class LuceneSupportPermsTest exte
         }
 
         // but alice still needs select privilege on the base table columns
-        String  viewPoemsIndex = "select * from table ( ruth.poems__poemText( 'star', 0 )
) luceneResults order by poemid";
+        String  viewPoemsIndex = "select * from table ( ruth.poems__poemText( 'star', 1000,
0 ) ) luceneResults order by poemid";
         String[][]  viewPoemsIndexResults = new String[][]
             {
                 { "3", "3", "2", "0.22933942" },
@@ -443,7 +443,7 @@ public class LuceneSupportPermsTest exte
             (
              ruthConnection,
              "select p.originalAuthor, i.score\n" +
-             "from ruth.poems p, table ( ruth.poems__poemText( 'star', 0 ) ) i\n" +
+             "from ruth.poems p, table ( ruth.poems__poemText( 'star', 1000, 0 ) ) i\n" +
              "where p.poemID = i.poemID and p.versionStamp = i.versionStamp\n" +
              "order by i.score desc\n",
              new String[][]
@@ -525,7 +525,7 @@ public class LuceneSupportPermsTest exte
 
         String  query =
             "select p.originalAuthor, i.score\n" +
-            "from ruth.poems p, table ( ruth.poems__poemText( 'star', 0 ) ) i\n" +
+            "from ruth.poems p, table ( ruth.poems__poemText( 'star', 1000, 0 ) ) i\n" +
             "where p.poemID = i.poemID and p.versionStamp = i.versionStamp\n" +
             "order by i.score desc\n";
 
@@ -633,7 +633,7 @@ public class LuceneSupportPermsTest exte
         // vet index contents
         String  selectFromViewIndex =
             "select p.originalAuthor, i.score\n" +
-            "from ruth.poems p, table ( ruth.poemView__poemText( 'star', 0 ) ) i\n" +
+            "from ruth.poems p, table ( ruth.poemView__poemText( 'star', 1000, 0 ) ) i\n"
+
             "where p.poemID = i.poemID and p.versionStamp = i.versionStamp\n" +
             "order by i.score desc\n";
         assertResults
@@ -738,7 +738,7 @@ public class LuceneSupportPermsTest exte
             (
              ruthConnection,
              "select *\n" +
-             "from table ( ruth.poems__poemText( 'star', 0 ) ) i\n" +
+             "from table ( ruth.poems__poemText( 'star', 1000, 0 ) ) i\n" +
              "order by i.score desc\n",
              new String[][]
              {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java?rev=1585315&r1=1585314&r2=1585315&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java
Sun Apr  6 16:32:08 2014
@@ -72,7 +72,7 @@ public class LuceneSupportTest extends B
             (
              s.executeQuery
              (
-              "select * from table ( lucenetest.titles__title( 'grapes', 0 ) ) luceneResults"
+              "select * from table ( lucenetest.titles__title( 'grapes', 1000, 0 ) ) luceneResults"
               ),
              expectedRows
              );
@@ -85,7 +85,7 @@ public class LuceneSupportTest extends B
             (
              s.executeQuery
              (
-              "select * from table ( lucenetest.titles__title( 'grapes', .75 ) ) luceneResults"
+              "select * from table ( lucenetest.titles__title( 'grapes', 1000, .75 ) ) luceneResults"
               ),
              expectedRows
              );
@@ -94,7 +94,7 @@ public class LuceneSupportTest extends B
             (
              s.executeQuery
              (
-              "select * from table ( lucenetest.titles__title( 'grapes',  0.5) ) luceneResults"
+              "select * from table ( lucenetest.titles__title( 'grapes',  1000, 0.5) ) luceneResults"
               )
              );
 
@@ -108,7 +108,7 @@ public class LuceneSupportTest extends B
              s.executeQuery
              (
               "select title, author, publisher, documentID\n" +
-              "from lucenetest.titles t, table ( lucenetest.titles__title( 'grapes', 0 )
) l\n" +
+              "from lucenetest.titles t, table ( lucenetest.titles__title( 'grapes', 1000,
0 ) ) l\n" +
               "where t.id = l.id\n" 
               ),
              expectedRows
@@ -133,7 +133,7 @@ public class LuceneSupportTest extends B
              s.executeQuery
              (
               "select *\n" +
-              "from table ( lucenetest.titles__title( 'mice', 0 ) ) luceneResults\n"
+              "from table ( lucenetest.titles__title( 'mice', 1000, 0 ) ) luceneResults\n"
               )
              );
 	    
@@ -145,7 +145,7 @@ public class LuceneSupportTest extends B
              s.executeQuery
              (
               "select *\n" +
-              "from table ( lucenetest.titles__title( 'mice', 0 ) ) luceneResults\n"
+              "from table ( lucenetest.titles__title( 'mice', 1000, 0 ) ) luceneResults\n"
               )
              );
 	    
@@ -162,7 +162,7 @@ public class LuceneSupportTest extends B
              s.executeQuery
              (
               "select *\n" +
-              "from table ( lucenetest.titles__title( 'mice', 0 ) ) luceneResults\n"
+              "from table ( lucenetest.titles__title( 'mice', 1000, 0 ) ) luceneResults\n"
               ),
              expectedRows
              );



Mime
View raw message