[opencms-dev] search for queries with 3 chars (dev_6_0_1)
Bernd Wolfsegger
bw at code-create.com
Tue Oct 25 11:32:00 CEST 2005
Well, in this regard I ask myself for what use is the method:
setQueryLength(int length) in CmsSearch class ? :)
Well, in 6.0.2 the method setQuery in CmsSearch looks different ...
public void setQuery(String query) {
// do not replace %
query = CmsStringUtil.substitute(query, "%", "%25");
// do not replace +/-
query = CmsStringUtil.substitute(query, "+", "%2B");
query = CmsStringUtil.substitute(query, "-", "%2D");
m_query = CmsEncoder.decode(query, OpenCms.getSystemInfo().getDefaultEncoding());
resetLastResult();
}
Kind regards, Bernd
On Tuesday, 25. October 2005 11:59, Wiesner, Daniel wrote:
> hello developers,
>
> could you please set the hard coded value for the min query lenght from
> 4 to at least to 3? Users should be able to search for LVA, rot, DIS ...
>
>
>
> public void setQuery(String query) {
>
> query = CmsEncoder.decode(query);
>
> // for widget use the exception is thrown here to enforce the
> errmsg next to widget
> if (query.trim().length() < 4) {
> throw new CmsIllegalArgumentException(Messages.get().container(
> Messages.ERR_QUERY_TOO_SHORT_1,
> new Integer(4)));
> }
> m_query = query;
> }
>
>
> By the way, if a user types for example 2 chars only he gets an
> exception. I use a bean like this:
>
> <jsp:useBean id="search" scope="request"
> class="org.opencms.search.CmsSearch"> <jsp:setProperty name="search"
> property="*"/>
> </jsp:useBean>
>
> I have to put some aditional logic in my jsp or javascript in the
> htmlform to check the length before filling the bean. But wouldn't it be
> better to put it in the bean self so that I could use
> CmsSearch.getLastException() to get a localized error message?
>
> best regards
> Daniel
>
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list