You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by wa...@apache.org on 2003/08/07 14:41:25 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/search/basic BasicQueryImpl.java Literals.java

wam         2003/08/07 05:41:25

  Modified:    src/share/org/apache/slide/search/basic BasicQueryImpl.java
                        Literals.java
  Log:
  support for element <nresults>
  
  Revision  Changes    Path
  1.8       +15 -5     jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryImpl.java
  
  Index: BasicQueryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BasicQueryImpl.java	22 Aug 2002 11:53:32 -0000	1.7
  +++ BasicQueryImpl.java	7 Aug 2003 12:41:25 -0000	1.8
  @@ -121,6 +121,12 @@
        */
       public static final String PROP_OR_ALLPROP_ELEMENT_MISSING = "Required element <prop> or <allprop> not supplied";
       
  +    /**
  +     * Message of a BadQueryException that is thrown if the query element
  +     * neither contains a &lt;from&gt; nor a &lt;from&gt; element.
  +     */
  +    public static final String NRESULTS_MISSING = "Required element <nresults> (when limit is supplied) not supplied";
  +
       
       /** the NotNormalizer, may be overridden in extending classes */
       protected NotNormalizer notNormalizer;
  @@ -482,7 +488,11 @@
           }
           
           if (limitElement != null) {
  -            limit = new Integer (limitElement.getTextTrim()).intValue();
  +            Element nResElem = limitElement.getChild (Literals.NRESULTS, namespace);
  +            if (nResElem == null)
  +                throw new BadQueryException (NRESULTS_MISSING);
  +
  +            limit = new Integer (nResElem.getTextTrim()).intValue();
               limitDefined = true;
           }
       }
  
  
  
  1.14      +5 -4      jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java
  
  Index: Literals.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Literals.java	10 Jul 2003 07:22:34 -0000	1.13
  +++ Literals.java	7 Aug 2003 12:41:25 -0000	1.14
  @@ -107,6 +107,7 @@
       public static final String NOT_LT            = "not-lt";
       public static final String NOT_LTE           = "not-lte";
       public static final String NOT_PROPCONTAINS  = "not-propcontains";
  +    public static final String NRESULTS      = "nresults";
       public static final String OR            = "or";
       public static final String ORDER         = "order";
       public static final String ORDERBY       = "orderby";
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org