[opencms-dev] search for queries with 3 chars (dev_6_0_1)

Wiesner, Daniel daniel.wiesner at av-studio.de
Tue Oct 25 10:59:17 CEST 2005


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



More information about the opencms-dev mailing list