Good day,
I've also tried integarting hibernate-search with appfuse-jpa with no luck.
I tried it with:
* org.hibernate : hibernate-core : 3.2.5.ga : jar
* org.hibernate : hibernate-annotations : 3.3.0.GA : jar
* org.hibernate : hibernate-entitymanager : 3.3.1.GA : jar
* org.hibernate : hibernate-search : 3.0.0.GA : jar
Then I annotated Person.java
[code]
...
@Indexed( index = "person" )
public class Person extends BaseObject {
...
@DocumentId
public Long getId() {
...
@Field( name = "firstName" )
public String getFirstName() {
...
@Field( name = "lastName" )
public String getLastName() {
...
}
[/code]
and added the search() method.
[code]
public class PersonDaoJpa implements PersonDao {
...
public List<Person> search( String queryString ) throws DaoException
{
try
{
QueryParser queryParser = new QueryParser( "person.lastName",
new SimpleAnalyzer() );
org.apache.lucene.search.Query luceneQuery = queryParser.parse(
queryString );
/*FullTextEntityManager fullTextEntityManager =
Search.createFullTextEntityManager( entityManager );
FullTextQuery fullTextQuery =
fullTextEntityManager.createFullTextQuery( luceneQuery, new Class[]{
Person.class } );
List results = fullTextQuery.getResultList();
*/
Session session = ( Session ) entityManager.getDelegate();
FullTextSession fullTextSession =
org.hibernate.search.Search.createFullTextSession( session );
org.hibernate.search.FullTextQuery fullTextQuery =
fullTextSession.createFullTextQuery( luceneQuery, ew Class[]{ Person.class}
);
List results = fullTextQuery.list();
return results;
}
catch ( ParseException e )
{
throw new DaoException( e );
}
}
...
}
[/code]
But I am getting an empty list when I try to search for "Raible". ...Any
ideas why?
Thanks,
Franz
Note: To reproduce, checkout [1] and apply appfuse-jpa-hibernatesearch.patch
[1] http://appfuse-demos.googlecode.com/svn/trunk/tutorial-jpa
hetjongetje wrote:
>
> Hi Paul,
>
> I'm looking to do the same thing. I've also had some limited luck with
> using Compass before (although with XML mapping, rather than annotations)
> but I've found their documentation to be lacking. I'm really interested to
> get Hibernate Search working with a couple Appfuse-based projects.
>
> To get it working with Appfuse, it looks like a couple of issues need to
> be resolved --
>
> - Check http://www.hibernate.org/30.html for a Compatibility Matrix:
> - to use Hibernate Search, Hibernate Core 3.2.2 or above, Hibernate
> EntityManager / Annotations 3.3.x
> - Appfuse is currently on 3.2.1GA (see ticket
> http://issues.appfuse.org/browse/APF-632)
> - so you'd need override
> <hibernate.version>3.2.1.ga</hibernate.version> in Appfuse's base pom.xml
>
> - then there's the issue that Hibernate Search JARs aren't in either the
> Appfuse Maven Repo (http://static.appfuse.org/repository/org/hibernate/)
> or in any public repositories.. so you'd have to download them from
> RedHat/JBoss' website and install them manually (which I always find a
> huge pain!)
>
>
> Alex
>
>
>
>
> Paul Browne wrote:
>>
>> Folks,
>>
>> I'm wondering if anybody has any experience of getting Hibernate Search
>> working with Appfuse?
>>
>> Steps Taken
>> 1) Worked through the 'Getting started guide 'on the wiki (Struts
>> Modular / Hibernate) and now have a PersonDao and Unit test to update /
>> remove.
>> 2) Added Hibernate Search and Lucene to the pom
>> 3) Configured Person with annotations to indicate that it should be
>> indexed.
>> 4) Tried adding to hibernate the necessary properties to indicate where
>> the index should be created
>> (e.g.
>> hibernate.search.default.directory_provider=org.hibernate.search.store.FSDirectoryProvider
>> hibernate.search.default.indexBase=c:\temp\).
>> 5) Tried adding my own even listener to test if a hibernate update /
>> delete / add event is being fired (e.g.
>> hibernate.ejb.event.post-update=ie.paul.TestEventListener)
>> 6) for items 4 and 5, I have tried adding these properties in
>> hibernate.properties and hibernate.cfg.xml in both test and main folders
>>
>> Versions are Appfuse 2.0M4, Hibernate Search 3.0Beta and Lucene 2.1
>>
>> While hibernate picks up the configured listener, none of the events
>> fire when I run the PersonDaoTest.
>>
>> Questions
>> - Is there anything about the PersonDaoTest , that when called from mvn
>> test, would fail to fire the post update / insert / delete events?
>> - Is there any way that I can configure event listeners to work with
>> hibernate (after an add / delete or update).
>> - The samples given by hibernate search are for adding the necessary
>> properties to a hibernate.properties file. Is there any way that I
>> should add these to persitence.xml or hibernate.cfg.xml
>> - Is there anything unusual about the way hibernate is configured with
>> AppFuse that would make it difficult to add the additional
>> hibernate-search jar. I
>>
>> Thanks in advance
>>
>> Paul
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
http://www.nabble.com/file/p13575328/appfuse-jpa-hibernatesearch.patch
appfuse-jpa-hibernatesearch.patch
--
View this message in context:
http://www.nabble.com/Hibernate-Search-and-Appfuse-tf3566618s2369.html#a13575328
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]