[
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-372?pag...
]
Thomas Goetz commented on HSEARCH-372:
--------------------------------------
Ok, in my case it works if I extend
DocumentBuilderIndexedEntity.processFieldsForProjection like that:
--- snip ---
private static void processFieldsForProjection(PropertiesMetadata metadata, String[]
fields, Object[] result, Document document) {
final int nbrFoEntityFields = metadata.fieldNames.size();
for ( int index = 0; index < nbrFoEntityFields; index++ ) {
populateResult(
metadata.fieldNames.get( index ),
metadata.fieldBridges.get( index ),
metadata.fieldStore.get( index ),
fields,
result,
document
);
}
// handle ClassBridge
final int nbrOfClassFields = metadata.classNames.size();
for (int index = 0; index < nbrOfClassFields; index++) {
populateResult(
metadata.classNames.get(index),
metadata.classBridges.get(index),
metadata.classStores.get(index),
fields,
result,
document
);
}
final int nbrOfEmbeddedObjects = metadata.embeddedPropertiesMetadata.size();
for ( int index = 0; index < nbrOfEmbeddedObjects; index++ ) {
//there is nothing we can do for collections
if ( metadata.embeddedContainers.get( index ) == PropertiesMetadata.Container.OBJECT )
{
processFieldsForProjection(
metadata.embeddedPropertiesMetadata.get( index ), fields, result, document
);
}
}
}
--- snip ---
This may not be the desired solution, but as I only use ClassBridge with name() and
don't do anything unusual inside the ClassBridge implementations, I can live with that
hack for now.
ClassBridges are not handled in projection
------------------------------------------
Key: HSEARCH-372
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-372
Project: Hibernate Search
Issue Type: New Feature
Affects Versions: 3.1.0.GA
Reporter: Thomas Goetz
Priority: Critical
Fix For: 3.2.0
Attachments: ClassBridgeProjectionTest.zip
Values that were stored by a ClassBridge are not accessible via projection. Luke shows
the values, so I'm sure they are there. I think Emmanuel is already aware of the
problem, as stated here:
https://forum.hibernate.org/viewtopic.php?f=9&t=996373&view=previous
As I run Hibernate Search from within JBoss I'm not quit sure how to demonstrate this
bug in a standalone testcase. If someone gave me a hint on how this could be done without
too much pain, I'd supply a test case.
I use the following annotation on the class to be indexed:
@ClassBridge(
name = "amount_of_students",
index = Index.UN_TOKENIZED,
store = Store.YES,
impl = StudentsSizeBridge.class)
public class Teacher implements Serializable {
...
}
As I said, the amount_of_students value is correctly stored in the Lucene index (viewable
with Luke), but if I try to project the value within a FullTextQuery it is always empty.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira