Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Doing exact search in Lucene
PostPosted: Fri Feb 03, 2012 7:07 pm 
Regular
Regular

Joined: Tue May 17, 2011 1:45 am
Posts: 52
Hi,

How to have lucene do an exact search? Example if I provide "Soft " I am getting results like Software, but I want lucene to search only the word as is without it being part of another word.

Thanks,
David


Top
 Profile  
 
 Post subject: Re: Doing exact search in Lucene
PostPosted: Sun Feb 05, 2012 9:00 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2296
Location: Third rock from the Sun
Hi,
the different ways in which Strings are going to be matched is defined by the Analyzer you use. There are lots of analyzers, and in the reference manual you can find ways to easily customize/configure them, or of course you could write your own.

If all you want is exact String matches like defined by String.equals() then just disable the Analyzer on the field.

Code:
@Field(index = Index.YES, analyze = Analyze.NO, ..
String getName() {

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.