-->
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: i18n and search
PostPosted: Thu Mar 26, 2009 5:51 pm 
Beginner
Beginner

Joined: Thu Sep 08, 2005 10:29 am
Posts: 21
First of all I'm new into Lucene queries etc. I'm experimenting right now with it in combination with Hibernate Search.

What I'm wondering is of I can index numbers related to i18n.

E.g. I have a Book entity with a price attribute.
A book with a price of 19.99 can be found while searching for price:19.99.

The thing is Dutch users will search for 19,99 (different decimal symbol).
How can this be handled?
I'm trying to avoid converting data myself.

Furthermore, Dutch users will search for something like prijs:19,99.
Can this be done with aliases or something? The problem is maybe one day I want to support German language as well.
The front-end app can be translated by simply adding i18n resource bundles. Is something like this also possible for searching within Lucene/Hibernate Search?


Cheers,
Marcel


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 28, 2009 7:28 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
assuming the currency is always the same (euro) I would just split (using a custom analyzer) the value in euro and eurocent: the Analyzer should take care of splitting the value according to whatever type of separator is used.
You can use appropriate padding (remember the values are going to be sorted as a String, so you may want to converto something like 1,09 to "09" cents and not "9" cents.
This is having an additional benefit of restricting the field for range queries or filters: quite likely in case of prices as most of the time users are not interested in specifying also the cents in the ranges.

The internal naming of your fields shouldn't be affected by your i18 settings; think it the same way of a DB column: you wouldn't localize the column name in a table right?
you user interface will be localized, but internally you'll have to refer to the appropriate fields.

Quote:
Dutch users will search for something like prijs:19,99

This is assuming you give the users the flexibility yo write the Lucene query directly; in this cases you alsmost always want to "tune" the QueryParser, so you should remap the "prijs" to your field.
Also a price is usually defined as ranges, a good candidate to look into Search filters: using a combobox or sliders could be more practical, as it's hard to imagine your users would be so smart to type this kind of query.

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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 29, 2009 11:39 am 
Beginner
Beginner

Joined: Thu Sep 08, 2005 10:29 am
Posts: 21
Thanks Sanne,

As I said I'm experimenting with Hibernate Search.
I was hoping to use it instead of having multiple 'field_a like '%something%' or field_b like '%something'%' added to SQL query.

I still see benefits in using Hibernate Search but to make it really useful I need to add logic to my app. The same logic as I would use to dynamically create the SQL queries.

I guess I need to rethink about using Hibernate Search or not. This is not meant as critism at all; it's just about making the right choice for my situation.

Cheers,
Marcel


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.