Author: epbernard
Date: 2007-07-25 15:32:50 -0400 (Wed, 25 Jul 2007)
New Revision: 12815
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/FullTextQuery.java
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java
trunk/HibernateExt/search/src/java/org/hibernate/search/query/FullTextQueryImpl.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/query/ProjectionQueryTest.java
Log:
HSEARCH-100 renaming to setProjection and mark the old name as deprecated
Modified: trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java
===================================================================
--- trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java 2007-07-25
03:55:07 UTC (rev 12814)
+++ trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java 2007-07-25
19:32:50 UTC (rev 12815)
@@ -66,6 +66,12 @@
* If the projected field is not a projectable field, null is returned in the object[]
*
*/
+ FullTextQuery setProjection(String... fields);
+
+ /**
+ * @deprecated Use #setProjection
+ *
+ */
FullTextQuery setIndexProjection(String... fields);
/**
Modified: trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/FullTextQuery.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/FullTextQuery.java 2007-07-25
03:55:07 UTC (rev 12814)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/FullTextQuery.java 2007-07-25
19:32:50 UTC (rev 12815)
@@ -59,5 +59,5 @@
* If the projected field is not a projectable field, null is returned in the object[]
*
*/
- FullTextQuery setIndexProjection(String... fields);
+ FullTextQuery setProjection(String... fields);
}
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java 2007-07-25
03:55:07 UTC (rev 12814)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java 2007-07-25
19:32:50 UTC (rev 12815)
@@ -60,8 +60,8 @@
return this;
}
- public FullTextQuery setIndexProjection(String... fields) {
- query.setIndexProjection( fields );
+ public FullTextQuery setProjection(String... fields) {
+ query.setProjection( fields );
return this;
}
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/query/FullTextQueryImpl.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/query/FullTextQueryImpl.java 2007-07-25
03:55:07 UTC (rev 12814)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/query/FullTextQueryImpl.java 2007-07-25
19:32:50 UTC (rev 12815)
@@ -480,7 +480,7 @@
return this;
}
- public FullTextQuery setIndexProjection(String... fields) {
+ public FullTextQuery setProjection(String... fields) {
if ( fields == null || fields.length == 0 ) {
this.indexProjection = null;
}
Modified:
trunk/HibernateExt/search/src/test/org/hibernate/search/test/query/ProjectionQueryTest.java
===================================================================
---
trunk/HibernateExt/search/src/test/org/hibernate/search/test/query/ProjectionQueryTest.java 2007-07-25
03:55:07 UTC (rev 12814)
+++
trunk/HibernateExt/search/src/test/org/hibernate/search/test/query/ProjectionQueryTest.java 2007-07-25
19:32:50 UTC (rev 12815)
@@ -37,7 +37,7 @@
Query query = parser.parse( "dept:ITech" );
org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query,
Employee.class );
// Is the 'FullTextQuery.ID' value correct here? Do we want the Lucene internal
document number?
- hibQuery.setIndexProjection( "id", "lastname", "dept",
FullTextQuery.THIS, FullTextQuery.SCORE, FullTextQuery.BOOST, FullTextQuery.DOCUMENT,
FullTextQuery.ID );
+ hibQuery.setProjection( "id", "lastname", "dept",
FullTextQuery.THIS, FullTextQuery.SCORE, FullTextQuery.BOOST, FullTextQuery.DOCUMENT,
FullTextQuery.ID );
ScrollableResults projections = hibQuery.scroll();
@@ -128,7 +128,7 @@
Query query = parser.parse( "dept:ITech" );
org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query,
Employee.class );
- hibQuery.setIndexProjection( "id", "lastname", "dept",
FullTextQuery.THIS, FullTextQuery.SCORE, FullTextQuery.BOOST, FullTextQuery.DOCUMENT,
FullTextQuery.ID );
+ hibQuery.setProjection( "id", "lastname", "dept",
FullTextQuery.THIS, FullTextQuery.SCORE, FullTextQuery.BOOST, FullTextQuery.DOCUMENT,
FullTextQuery.ID );
int counter = 0;
@@ -162,7 +162,7 @@
Query query = parser.parse( "dept:Accounting" );
org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query,
Employee.class );
- hibQuery.setIndexProjection( "id", "lastname", "dept",
FullTextQuery.THIS, FullTextQuery.SCORE, FullTextQuery.BOOST, FullTextQuery.DOCUMENT,
FullTextQuery.ID );
+ hibQuery.setProjection( "id", "lastname", "dept",
FullTextQuery.THIS, FullTextQuery.SCORE, FullTextQuery.BOOST, FullTextQuery.DOCUMENT,
FullTextQuery.ID );
List result = hibQuery.list();
assertNotNull( result );
@@ -180,7 +180,7 @@
assertEquals( "ID incorrect", 1001, projection[7] );
// Change the projection order and null one
- hibQuery.setIndexProjection( FullTextQuery.DOCUMENT, FullTextQuery.THIS,
FullTextQuery.SCORE, null, FullTextQuery.ID, "id", "lastname",
"dept" );
+ hibQuery.setProjection( FullTextQuery.DOCUMENT, FullTextQuery.THIS,
FullTextQuery.SCORE, null, FullTextQuery.ID, "id", "lastname",
"dept" );
result = hibQuery.list();
assertNotNull( result );
@@ -238,7 +238,7 @@
Query query = parser.parse( "summary:Festina" );
org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Book.class
);
- hibQuery.setIndexProjection( "id", "summary",
"mainAuthor.name" );
+ hibQuery.setProjection( "id", "summary",
"mainAuthor.name" );
List result = hibQuery.list();
assertNotNull( result );
@@ -249,7 +249,7 @@
assertEquals( "mainAuthor.name (embedded objects)", "Emmanuel",
projection[2] );
hibQuery = s.createFullTextQuery( query, Book.class );
- hibQuery.setIndexProjection( "id", "body",
"mainAuthor.name" );
+ hibQuery.setProjection( "id", "body", "mainAuthor.name"
);
try {
result = hibQuery.list();
@@ -261,14 +261,14 @@
hibQuery = s.createFullTextQuery( query, Book.class );
- hibQuery.setIndexProjection();
+ hibQuery.setProjection();
result = hibQuery.list();
assertNotNull( result );
assertEquals( 1, result.size() );
assertTrue( "Should not trigger projection", result.get( 0 ) instanceof Book
);
hibQuery = s.createFullTextQuery( query, Book.class );
- hibQuery.setIndexProjection( null );
+ hibQuery.setProjection( null );
result = hibQuery.list();
assertNotNull( result );
assertEquals( 1, result.size() );
@@ -276,7 +276,7 @@
query = parser.parse( "summary:fleurs" );
hibQuery = s.createFullTextQuery( query, Book.class );
- hibQuery.setIndexProjection( "id", "summary",
"mainAuthor.name" );
+ hibQuery.setProjection( "id", "summary",
"mainAuthor.name" );
result = hibQuery.list();
assertEquals( 1, result.size() );
projection = (Object[]) result.get( 0 );