Hi,
im using HS 3.0.1 with Hibernate 3.2.6.
I've annotated a class, which has just 3 Fields on its own (to index), but a lot of fields which it is inheriting from its superclass.
Now i want to get all the fields that are indexed on this class. With the use of IndexReader.getFieldNames(FieldOption.All) i get to it successfully with
the superclass, but applying that code to the inherited one, i get back an emtpy collection. Can anyone tell me how to get the (indexed) fields of the inheriting one?
my code:
Code:
DirectoryProvider<?> provider = null;
ReaderProvider readerProvider = fSession.getSearchFactory()
.getReaderProvider();
IndexReader indexReader = null;
try {
for (Class<?> c : classes) {
if (sFactory != null) {
DirectoryProvider<?>[] provArr = sFactory
.getDirectoryProviders(c);
if (provArr != null) {
provider = sFactory.getDirectoryProviders(c)[0];
if (provider != null) {
indexReader = readerProvider.openReader(provider);
Collection<?> tmpFields = indexReader
.getFieldNames(FieldOption.INDEXED);
superclass Attribute.java:
Code:
@Entity
public abstract class Attribute implements Serializable {
@DocumentId
private Integer id = null;
@display
@Field
private Boolean active = Boolean.FALSE;
...
inherited class AttributeFA.java:
Code:
@Entity
@Indexed
public class AttributeFA extends Attribute {
private static final long serialVersionUID = 1L;
@display
@Field
private String att1 = null;
@display
@Field
private String att2 = null;
@display
@Field
private String att3 = null;
...