-->
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.  [ 3 posts ] 
Author Message
 Post subject: Search for a field containing 2 or 3 words in a text
PostPosted: Tue Aug 04, 2009 7:02 am 
Newbie

Joined: Tue Aug 04, 2009 6:46 am
Posts: 17
Hi friends
i am newbie to hibernate search (lucene)
i have a issue while searching using lucene
I have indexed a field (UNTOKENIZED)
luke tool shows the follwing in the field

>> United States
>> chicago

sometimes the field may contain more than 1 word , so while searching that field iam unable to get results for the text containing "blah blah United States blah blah "
even Iam not getting results for "blah blah States blah blah "
But iam able to get results for "blah blah chicago blah "
So in order to solve this problem what kind of analyzers i need to use

thanks in advance


Top
 Profile  
 
 Post subject: Re: Search for a field containing 2 or 3 words in a text
PostPosted: Tue Aug 04, 2009 9:12 am 
Newbie

Joined: Wed Jul 15, 2009 12:34 pm
Posts: 18
It's very important to match the indexing analyzers and the search analyzers in order to get the desired search results. Since you indexed the field with UNTOKENIZED, I believe that you should use the KeywordAnalyzer in order to search this field.


Top
 Profile  
 
 Post subject: Re: Search for a field containing 2 or 3 words in a text
PostPosted: Wed Aug 05, 2009 11:10 am 
Hibernate Team
Hibernate Team

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

The reason for your result is that per default search terms are combined by 'OR'. In your first example you are searching for "United" or "States". These tokens are not in your index since you indexed "United Stated" UNTOKENIZED, meaning as is. No analyzers are applied at indexing time. I guess searching for "United States" (in quotes) would work. The chicago works since it is a single word.

That said, are you sure that you want to index UNTOKENIZED? What's your actual usecase?

--Hardy


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