-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: How to search contents of text using hibernate search
PostPosted: Fri Oct 24, 2008 6:11 pm 
Newbie

Joined: Tue Nov 27, 2007 7:11 pm
Posts: 9
I am trying to use Hibernate Search and i have gone thru hibernate docs search reference material (Section 1.5)and by implementing that, it works fine but only for the fullText search.

http://www.hibernate.org/hib_docs/searc ... ml_single/

But for example..

if the column in the table has a value of "Java Rocks", i want to specify only "Java" and i want my query to return all the columns which contains the text "Java".

Could some one please help me with this.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 25, 2008 9:33 am 
Beginner
Beginner

Joined: Thu Sep 11, 2008 5:33 am
Posts: 28
ok can you please explain what all thing you have done?

Have you include English Analyzer there?

Regards,
Sachin Parnami


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 27, 2008 11:40 am 
Newbie

Joined: Tue Nov 27, 2007 7:11 pm
Posts: 9
When I try to include English Analyzer, i was getting RuntimeExcepiton

java.lang.ClassNotFoundException: net.sf.snowball.ext.contentStemmer

I couldn't find that class in any of the lucene jars.

Here is what i was doing.

@Analyzer(impl = com.ercot.testapp.utils.EnglishAnalyzer.class)
public class Test implements java.io.Serializable {

@DocumentId
private Long testId;
@Field(name = "content", index=Index.TOKENIZED, store=Store.NO)
private String stationName;
@Field(name = "content", index=Index.TOKENIZED, store=Store.NO)
private String unitName;

// getters & setters for all the attribues
}


public class EnglishAnalyzer extends Analyzer {
/**
* {@inheritDoc}
*/
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
TokenStream result = new StandardTokenizer(reader);
result = new StandardFilter(result);
result = new LowerCaseFilter(result);
result = new SnowballFilter(result, fieldName);
return result;
}
}

i don't have any analyzer properties in my hibernate.cfg file.

I am using the following jars

hibernate-annotations.jar
hibernate3.jar
hibernate-commons-annotations.jar
hibernate-search.jar
lucene-core-2.3.0.jar
lucene-snowball-2.3.0.jar

let me know if you need more details.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2008 2:42 pm 
Newbie

Joined: Tue Nov 27, 2007 7:11 pm
Posts: 9
Any idea on this.. Could some one please help me with this.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 29, 2008 2:17 am 
Beginner
Beginner

Joined: Thu Sep 11, 2008 5:33 am
Posts: 28
just try to change you code from

@Field(name = "content", index=Index.TOKENIZED, store=Store.NO)
private String stationName;
@Field(name = "content", index=Index.TOKENIZED, store=Store.NO)
private String unitName;

to

@Field(name = "english", index=Index.TOKENIZED, store=Store.NO)
private String stationName;
@Field(name = "english", index=Index.TOKENIZED, store=Store.NO)
private String unitName;


lets see how it helps :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 29, 2008 11:37 am 
Newbie

Joined: Tue Nov 27, 2007 7:11 pm
Posts: 9
I got rid of RuntimeException with the change you suggested.

But my query is not returning any records now...... (neither with Java nor Java Rocks search)

Any other suggestions???


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 29, 2008 11:55 pm 
Beginner
Beginner

Joined: Thu Sep 11, 2008 5:33 am
Posts: 28
:( Bad luck tried that too but same no substantial result :(

let's see if any buddy else replies here


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.