[hibernate-dev] [infinispan-dev] Querying Infinispan -- Help Needed
Navin Surtani
nsurtani at redhat.com
Thu Nov 19 05:34:25 EST 2009
Hiya Vinoth,
I just ran my tests locally, and they seem to be working fine.
My class in my test looks like this: -
@ProvidedId(bridge = @FieldBridge(impl = StringBridge.class))
@Indexed(index = "person")
public class Person implements Serializable {
@Field(store = Store.YES)
private String name;
@Field(store = Store.YES)
private String blurb;
@Field(store = Store.YES, index = Index.UN_TOKENIZED)
private int age;
Perhaps if you have a look at the differences between our annotations
and have a play around you'll be able to find out what the issue is. I
used exactly the same annotations as you did
On 19 Nov 2009, at 07:02, Vinoth wrote:
> Hi,
>
> I have a problem in getting through the querying feature of
> infinispan. I am using the technical preview listed in this wiki
> page with the help of the sample code provided in the same page.
>
> I used the following properties for the second argument in
> QueryHelper Constructor.
> #hibernate.properties
> hibernate.search.default.directory_provider
> org.hibernate.search.store.FSDirectoryProvider
> hibernate.search.default.indexBase=/usr/vin/lucene/indexes
>
> This is my class for Hibernate Search
>
> @ProvidedId
> @Indexed
> public class Item {
>
> @Field
> private String name;
> @Field
> private String description;
>
> ...// getters and setters
> }
>
> I have included the @ProvidedId since QueryHelper instantiation
> validates the classes based on this annotation.
> Note :: QueryHelper.validateClasses() -- This is to check that both
> the @ProvidedId is present and the the @DocumentId is not present.
> This is because don't want both of these 2 annotations used at the
> same time.
>
> When I used the @Indexed annotation for the above class, it throws
> an exception while instantiating the QueryHelper.
>
> <Exception Snippet>
> java.lang.NullPointerException
> at
> org.hibernate.search.engine.DocumentBuilderIndexedEntity.init
> (DocumentBuilderIndexedEntity.java:151)
> at
> org.hibernate.search.engine.DocumentBuilderContainedEntity.<init>
> (DocumentBuilderContainedEntity.java:93)
> at
> org.hibernate.search.engine.DocumentBuilderIndexedEntity.<init>
> (DocumentBuilderIndexedEntity.java:128)
> at
> org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders
> (SearchFactoryImpl.java:409)
> at org.hibernate.search.impl.SearchFactoryImpl.<init>
> (SearchFactoryImpl.java:119)
> at org.infinispan.query.backend.QueryHelper.<init>
> (QueryHelper.java:87)
> <Exception Snippet>
>
> When I removed that @Indexed annotation, QueryHelper got
> instantiated but it throwed some exception when it hits
> CacheQuery.getBasicQuery() method, where it forms lucene query
> string with the help of QueryParser.
>
> org.hibernate.HibernateException: There are no mapped entities.
> Don't forget to add @Indexed to at least one class.
Yes, Hibernate Search will throw an exception if you don't specify if
any of your classes are Entities. If there aren't any entities then it
doesn't know what to index :-).
>
> Please let me know if I missed anything here.
>
> Thanks in advance,
> Vinoth
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
Navin Surtani
Intern Infinispan
Intern JBoss Cache Searchable
More information about the hibernate-dev
mailing list