Well, given that we're therefore on the requisite version of Hibernate;
it's more a bug for the hibernate folks than xwiki then.
-----Original Message-----
From: Vincent Massol [mailto:vincent@massol.net]
Sent: 28 March 2007 10:03
To: xwiki-users(a)objectweb.org
Subject: Re: [xwiki-users] Re: Case insensitive search
On Mar 28, 2007, at 10:52 AM, Esbach, Brandon wrote:
Well, I can confirm it's an issue for me on MySQL.
It raises an Xwiki
exception, though it's not clear if the exception
is bubbling up from
hibernate, or from xwiki itself.
According to the v3 hibernate docs (not sure what vers of hib xwiki
uses)
3.1.2 (check your WEB-INF/lib :-))
, it is supposed to be supported - search for
"insensitive" on the
hibernate docs site; returns three results, first one covers ilike.
Exactly my point. We should investigate this first rather than trying to
implement it ourselves and only if it doesn't work then we should think
of alternative solutions.
One would think the hibernate.cfg.xml allows you to
remap key things
like the ilike/like, etc; but failing that, perhaps instead of
"fixing"
this as a hardcoded change,:
How about a new config set for the xwiki.cfg file? So then if someone
uses an odd database, supporting it should not require
added effort
(just checking keywords). For example, replacing like and % (memory
scratchy, but iirc postgresql supports _ as well as % for single
wildcards?).
hibernate.replace.list=like,%,'
<the list is used so that you're not constantly scanning the whole
config file for replacements> hibernate.replace.like=ilike
hibernate.replace.%=_ hibernate.replace.'=''
Isn't this one purpose of Hibernate (to isolate yourself from the DB)?
Thanks
-Vincent
The last one there would be a godsend as you often get
users that
stick in a ' that needs to be escaped, though you can use .replace(),
it's still tacky that way.
-----Original Message-----
From: Vincent Massol [mailto:vincent@massol.net]
Sent: 27 March 2007 20:42
To: xwiki-users(a)objectweb.org
Subject: Re: [xwiki-users] Re: Case insensitive search
On Mar 27, 2007, at 9:33 PM, Zeljko Trogrlic wrote:
> Vincent Massol wrote:
>> On Mar 27, 2007, at 4:19 PM, Zeljko Trogrlic wrote:
>>> Esbach, Brandon <Esbachb@...> writes:
>>>
>>>> PostgreSQL treats LIKE queries as case-sensitive; so to make it
>>>> case-insensitive you would have to use ilike (extra i in front of
>>>> like) to make it case-insensitive.
>>>
>>> ILIKE is PostgreSQL specific. Two UPPERCASE will work on any
>>> database.
>> Are you sure there isn't any hibernate-specific solution to the
>> problem? (which IMO might be better) What about using something like
>> the ilike in http://
>>
www.hibernate.org/hib_docs/v3/api/org/hibernate/criterion/
>> Restrictions.html? Does anyone know how to use this Expression class
in Hibernate?
Thanks
-Vincent
ILIKE is not in HQL reference. Can somebody running something else
than PostgreSQL test is it working on his system?
If ILIKE doesn't work on other databases, I'll rather keep UPPERs
because fiddling with Hibernate API in Velocity is both impossible
and, to my standards, over-engineered.
I don't think it should be done in Velocity at all. We could do it in
Java, in the search implementations.
Again, I don't know how this works (or doesn't work) in Hibernate.
I'm just making sure we've covered all angles before deciding.
Thanks
-Vincent