-->
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: Applying analyzer in wildcard queries
PostPosted: Fri Apr 20, 2012 7:36 am 
Newbie

Joined: Fri Apr 20, 2012 7:07 am
Posts: 2
Hi,
we are trying to use HibernateSearch in our application because we need the possibility of fuzzy searching. So far we basically use SQL queries on the database.
Now we have the problem of how to use both fuzzy and wildcard queries on the same index.
It is recommended to use the same analyzer on both indexing and searching. So we defined an analyzer that uses StandardFilter, LowerCaseFilter and ASCIIFoldingFilter.
But wildcard queries do not apply the analyzer on the matching terms, so e.g. "Äpfel" doesn't find "Äpfel und Birnen".
These two rules ("use the same analyzer" and "wildcard queries do not apply the analyzer") seem to be conflicting - or do we miss anything here?
Is there any way to force a wildcard query to apply the analyzer? Or to apply the analyzer's filters on our search term before building the wildcard query?

Thanks for any hint,
Friederike


Top
 Profile  
 
 Post subject: Re: Applying analyzer in wildcard queries
PostPosted: Mon Apr 23, 2012 6:12 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Friederike,
do you have a suggestion on how we could improve the QueryBuilder ? Maybe if you could provide a working testcase we can make this easier.

In the meantime you could indeed filter the query terms yourself by using the utilities in
Code:
org.hibernate.search.util.AnalyzerUtils

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


Top
 Profile  
 
 Post subject: Re: Applying analyzer in wildcard queries
PostPosted: Mon Apr 23, 2012 9:05 am 
Newbie

Joined: Fri Apr 20, 2012 7:07 am
Posts: 2
Hi Sanne,

thanks for the suggestion. Unfortunately we are bound to Hibernate 3.6.6, ergo to HibernateSearch 3.4.1 which doesn't yet provide AnalyzerUtils.
I guess I have to write my own normalizing procedure until we can move to the newest version of HibernateSearch.

When we tried to solve our problem we hoped to find a way to force wildcard queries to apply an analyzer. But ConnectedMultiFieldsTermQueryBuilder.getAllTermsFromText() generally doesn't use the Analyzer if Approximation is WILDCARD. This is confusing since createQuery() only calls getAllTermsFromText if the FieldContext is not set to ignore the analyzer.

It would be great having a way to tell the QueryBuilder to use the analyzer independent from the TermContext.Approximation.
Or, even better, to have the QueryBuilder respect the FieldContext's ignoreAnalyzer flag and set the flag to true when creating a WildCardContext.

I still don't get why wildcard queries do ignore the analyzer at all. Following the rule of thumb to use the same analyzer for indexing and searching I should be able to use the analyzer for all kinds of queries.
What am I missing here?

Thanks for your help,
Friederike


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.