[hibernate-dev] DocumentBuilder refactoring in Hibernate Search: how to deal (internally) with metadata

Gunnar Morling gunnar at hibernate.org
Fri May 31 08:14:19 EDT 2013


2013/5/31 Hardy Ferentschik <hardy at hibernate.org>

>
> > public interface IndexedEntityDescriptor {
> >
> > I find the name "IndexedEntityDescriptor" in conjunction with
> isIndexed() potentially returning "false" a bit irritating. Maybe just
> EntityDescriptor? Or SearchableEntityDescriptor?
>
> I thought about EntityDescriptor, but found it to generic. Somehow I
> wanted to have the connection to Search/Lucene. SearchableEntityDescriptor
> implies that I can search
> something in the descriptor.


Ah, I meant it as in "descriptor for a searchable entity" but I see that
this can be mistaken.


> I am not 100% happy about IndexedEntityDescriptor either, but for now I
> still think it is the best.
>
> >         boolean isIndexed();
> >
> > Maybe return an enum if this can potentially be more than a simple
> yes/no? I don't know how likely that is, but an enum would allow for
> evolvement.
>
> Not sure this is needed. I don't foresee that this would change.
>

Maybe a value such as HAS_INDEXED_SUBTYPES might make sense at some point?
I'm not sure whether that's needed either, but in contrast to a boolean an
enum (with initially just two values) would allow for future additions,
should that be required.


>
> >         Set<String> getIndexNames();
> >
> > Would something like Set<IndexDescriptor> getIndexes() make sense?
>
> That's an interesting thought. In fact I was wondering whether more index
> specific information is needed. On the other hand,
> I was thinking thinking that as long as you have the index name you can
> always get more information via accessing the IndexManager
> directly -
> SearchFactoryImplementor.getAllIndexesManager.getIndexManager(String
> indexName)
>
> Now that you bring it up, I am wondering, however, if we could expose
> thinks like directory type via a IndexDescriptor.
>
> > At least for my case I think it would be easier if this contained all
> field descriptors so I can handle them uniformly. Maybe
> FieldDescriptor#isId() or if there are more id specific things something
> like this could be added:
>
> sounds good
>
> >         // TODO should OBJECT_CLASS be considered?
> >         Set<FieldDescriptor> getIndexedFields();
> >
> > Could you also add FieldDescriptor getIndexedField(String fieldName);
>
> sure
>
> > public interface FieldDescriptor {
> >         /**
> >          * Returns the Lucene {@code Document} field name for this
> indexed property.
> >          *
> >          * @return Returns the field name for this index property
> >          */
> >         String getFieldName();
> >
> > I'd call it just "getName()", not repeating the type's name.
>
> ok
>
> > public interface FieldNameReportingBridge {
> >         Iterable<String> getGeneratedFieldNames(String baseFieldName);
> > }
> >
> > Not better a Set? Returning Iterable makes it harder for users (e.g. no
> contains()) and also hides set vs. list semantics.
>
> +1
>
> thanks for the great feedback :-)
>
>
> --Hardy
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list