Author: epbernard
Date: 2007-05-30 16:24:24 -0400 (Wed, 30 May 2007)
New Revision: 11598
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.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:
Rename setProjection to setIndexProjection
Modified: trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java
===================================================================
--- trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java 2007-05-30
03:05:58 UTC (rev 11597)
+++ trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java 2007-05-30
20:24:24 UTC (rev 11598)
@@ -58,5 +58,5 @@
* If the projected field is not a projectable field, null is returned in the object[]
*
*/
- FullTextQuery setProjection(String... fields);
+ FullTextQuery setIndexProjection(String... fields);
}
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/query/FullTextQueryImpl.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/query/FullTextQueryImpl.java 2007-05-30
03:05:58 UTC (rev 11597)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/query/FullTextQueryImpl.java 2007-05-30
20:24:24 UTC (rev 11598)
@@ -63,7 +63,7 @@
private Integer resultSize;
private Sort sort;
private Criteria criteria;
- private String[] projection;
+ private String[] indexProjection;
/**
* classes must be immutable
@@ -105,9 +105,9 @@
Session sess = (Session) this.session;
List<EntityInfo> entityInfos = new ArrayList<EntityInfo>( max - first + 1
);
- DocumentExtractor extractor = new DocumentExtractor( searchFactory, projection );
+ DocumentExtractor extractor = new DocumentExtractor( searchFactory, indexProjection
);
for ( int index = first; index <= max; index++ ) {
- //TODO use indexSearcher.getIndexReader().document( hits.id(index),
FieldSelector(projection) );
+ //TODO use indexSearcher.getIndexReader().document( hits.id(index),
FieldSelector(indexProjection) );
Document document = hits.doc( index );
entityInfos.add( extractor.extract( document ) );
}
@@ -128,7 +128,7 @@
}
private Loader getLoader(Session session, SearchFactory searchFactory) {
- if (projection != null) {
+ if ( indexProjection != null) {
ProjectionLoader loader = new ProjectionLoader();
loader.init( session, searchFactory );
return loader;
@@ -181,7 +181,7 @@
hits = getHits( searcher );
int first = first();
int max = max( first, hits );
- DocumentExtractor extractor = new DocumentExtractor( searchFactory, projection );
+ DocumentExtractor extractor = new DocumentExtractor( searchFactory, indexProjection
);
Loader loader = getLoader( (Session) this.session, searchFactory );
return new ScrollableResultsImpl( searcher, hits, first, max, extractor, loader,
searchFactory);
}
@@ -214,7 +214,7 @@
int max = max( first, hits );
Session sess = (Session) this.session;
List<EntityInfo> infos = new ArrayList<EntityInfo>( max - first + 1 );
- DocumentExtractor extractor = new DocumentExtractor( searchFactory, projection );
+ DocumentExtractor extractor = new DocumentExtractor( searchFactory, indexProjection
);
for ( int index = first; index <= max; index++ ) {
Document document = hits.doc( index );
infos.add( extractor.extract( document ) );
@@ -374,12 +374,12 @@
return this;
}
- public FullTextQuery setProjection(String... fields) {
+ public FullTextQuery setIndexProjection(String... fields) {
if ( fields == null || fields.length == 0) {
- this.projection = null;
+ this.indexProjection = null;
}
else {
- this.projection = fields;
+ this.indexProjection = fields;
}
return this;
}
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-05-30
03:05:58 UTC (rev 11597)
+++
trunk/HibernateExt/search/src/test/org/hibernate/search/test/query/ProjectionQueryTest.java 2007-05-30
20:24:24 UTC (rev 11598)
@@ -32,7 +32,7 @@
Query query = parser.parse( "summary:Festina" );
org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Book.class
);
- hibQuery.setProjection( "id", "summary", "body",
"mainAuthor.name");
+ hibQuery.setIndexProjection( "id", "summary", "body",
"mainAuthor.name");
List result = hibQuery.list();
assertNotNull( result );
@@ -44,14 +44,14 @@
assertEquals( "mainAuthor.name (embedded objects)", "Emmanuel",
projection[3] );
hibQuery = s.createFullTextQuery( query, Book.class );
- hibQuery.setProjection();
+ hibQuery.setIndexProjection();
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.setProjection(null);
+ hibQuery.setIndexProjection(null);
result = hibQuery.list();
assertNotNull( result );
assertEquals( 1, result.size() );