-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Search with the combination of like search
PostPosted: Thu Feb 05, 2009 8:20 am 
Beginner
Beginner

Joined: Mon Oct 01, 2007 8:21 am
Posts: 40
Hi,

Is it possible to do like search with hibernate search.

like suppose the value stored for a Event Name is 'Online Tradeshow'

Even Name field is being indexed.

Now if i search for 'Trade' or 'show' would i be able to get the result.. is this possible.

I have done tokenizing the words.

If i search for Tradeshow i will get the result.

But the above case??? any suggestions???

Is it possible???

Thanks,
Ambika.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2009 9:56 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

your problem is more a problem of the Lucene query API. In the case where you want to get a match for 'trade' you should get away with a prefix query - 'trade*' or problematically via the PrefixQuery class.

The other case - 'show' is more problematic. Per default Lucene does not allow leading wildcard searches like '*show'. That said there is a QueryParser. setAllowLeadingWildcard() method which allows you to execute such wildcard searches. Performance might be bad though (see http://wiki.apache.org/jakarta-lucene/L ... 09848ea695).

An alternative would be to use a filter with a WildCardTermEnum together with a ConstantScoreQuery - http://www.gossamer-threads.com/lists/l ... user/38426

So there are solutions to your problem, but you have to search more in Lucene than in Hibernate Search to find them. Check the Lucene mailing list. I am sure there are many post regarding leading wildcard queries.

Hope this helps.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.