Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Hibernate search - indexes not being generated  RSS feed

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am new to Hibernate search. But after all set up, I get blank list of object on every search. In the index directory, though I see segments and segments.gen files, they are just a 1 kb files (where my table is full of data). I think the indexes are not being generated for the table. Does anyone has any idea about it? Please help.

Thanks
Smitha
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You haven't provided much to go on--please TellTheDetails.
 
Smitha H Rao
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have integrated hibernate serach into an existing spring and hibernate web application. I have added following 2 in the persistence.xml files:
<property name="hibernate.search.default.directory_provider"
value="org.hibernate.search.store.FSDirectoryProvider" />
<property name="hibernate.search.default.indexBase" value="e:\search" />

My eo class looks like below:
@Entity
@Table(name="test")
@Indexed
@AnalyzerDef(name = "customanalyzer",
tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class),
filters = {
@TokenFilterDef(factory = LowerCaseFilterFactory.class),
@TokenFilterDef(factory = SnowballPorterFilterFactory.class,
params = {
@Parameter(name = "language", value = "English")
})
})
public class TestEO extends UpdateableEO implements Test,java.io.Serializable {

private static final long serialVersionUID = 1L;

private TestCategoryEO testCategoryEO;
private SkillUserProfileEO guruEO;

@Transient
Test test;

@Transient
public Test getTest(){
return this.test;
}

public void setTest(Test test){
this.test=test;
}

public TestEO() {
this.test = new TestVO();
}

public TestEO(Test test) {
this.test=test;
}

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@DocumentId
@Column(name="test_id")
public Integer getTestId() {
return test.getTestId();
}

public void setTestId(Integer testSetId) {
test.setTestId(testSetId);
}

@Column(name="test_name", unique=false, nullable=true, insertable=true, updatable=true, length=45)
@Field(index=Index.TOKENIZED, store=Store.NO)
@Analyzer(definition = "customanalyzer")
public String getTestName() {
return test.getTestName();
}

public void setTestName(String testName) {
test.setTestName(testName);
}

@Column(name="test_desc")
@Field(index=Index.TOKENIZED, store=Store.NO)
@Analyzer(definition = "customanalyzer")
public String getTestDesc() {
return test.getTestDesc();
}

public void setTestDesc(String testDesc) {
test.setTestDesc(testDesc);
}
.....


The code I am using to do search is as follows:
String[] fields = new String[]{"testName","testDesc", "keywords"};

MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
org.apache.lucene.search.Query query = parser.parse( strTest );
// wrap Lucene query in a javax.persistence.Query
javax.persistence.Query persistenceQuery = testDAO.getFullTextEntityManager().createFullTextQuery(query, TestEO.class);
// execute search
System.out.println("created query::"+persistenceQuery.toString());
List<TestEO> result = persistenceQuery.getResultList();
System.out.println("result ::"+result);
if(result!=null){
tests = new ArrayList<TestVO>();
for (TestEO testeo : result) {
TestVO test = (TestVO) testeo.getTest();
test.setGuru(testeo.getGuruEO().getUserProfile());
test.setTestCategory(testeo.getTestCategoryEO().getTestCategory());
}
}


The problem is in the index directory, i. e in e/search I can see TestEO directory being created and inside that I see segments and segments.gen files, but they are just 1 kb files where my table is full of data.

Searching on any string shows blank List.. Please help me solving this.


Thanks
Smitha
 
Author and ninkuma
Marshal
Posts: 66801
168
IntelliJ IDE Java jQuery Mac Mac OS X
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!