cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/webapp/samples/search search-index.xsp
Date Sun, 14 Jul 2002 19:19:18 GMT
vgritsenko    2002/07/14 12:19:18

  Modified:    src/webapp/search Tag: cocoon_2_0_3_branch search-index.xsp
               src/webapp/samples/search search-index.xsp
  Log:
  Fix NPE in search XSP.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.3   +20 -13    xml-cocoon2/src/webapp/search/Attic/search-index.xsp
  
  Index: search-index.xsp
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/search/Attic/search-index.xsp,v
  retrieving revision 1.3.2.2
  retrieving revision 1.3.2.3
  diff -u -r1.3.2.2 -r1.3.2.3
  --- search-index.xsp	13 Jul 2002 18:43:21 -0000	1.3.2.2
  +++ search-index.xsp	14 Jul 2002 19:19:18 -0000	1.3.2.3
  @@ -98,7 +98,9 @@
       
       <title>Cocoon XML Search Interface</title>
       <content>
  -      <a href="http://jakarta.apache.org/lucene/"><img border="0" alt="Lucene
Logo" src="images/lucene_green_300.gif"/></a>
  +      <a href="http://jakarta.apache.org/lucene/">
  +        <img border="0" alt="Lucene Logo" src="images/lucene_green_300.gif"/>
  +      </a>
         <para>
           <small>
             <a href="../">Welcome</a> |
  @@ -160,24 +162,31 @@
               
               // do the search, search results are available in hits
               hits = search( queryString );
  -            luceneCocoonPager = new LuceneCocoonPager( hits );
  -            if (startIndex != null &amp;&amp; pageLength != null) {
  -              luceneCocoonPager.setStartIndex( startIndex.intValue() );
  -              luceneCocoonPager.setCountOfHitsPerPage( pageLength.intValue() );
  +            if (hits != null) {
  +              luceneCocoonPager = new LuceneCocoonPager( hits );
  +              if (startIndex != null &amp;&amp; pageLength != null) {
  +                luceneCocoonPager.setStartIndex( startIndex.intValue() );
  +                luceneCocoonPager.setCountOfHitsPerPage( pageLength.intValue() );
  +              }
  +              <xsp:content>
  +                Total Hits: <xsp:expr>hits.length()</xsp:expr>
  +              </xsp:content>
  +            } else {
  +              luceneCocoonPager = null;
  +              <xsp:content>
  +                No hits!
  +              </xsp:content>
               }
  -            <xsp:content>
  -              Total Hits: <xsp:expr>hits.length()</xsp:expr>
  -            </xsp:content>
             }
           </xsp:logic>
         </para>
         <para>
           <table width="90%" cellpadding="4" border="1">
  -          <tr>
  -            <td>Score</td><td>Count</td><td>URL</td>
  -          </tr>
             <xsp:logic>
               if (luceneCocoonPager!= null &amp;&amp; luceneCocoonPager.hasNext())
{
  +              <tr>
  +                <td>Score</td><td>Count</td><td>URL</td>
  +              </tr>
                 int counter = luceneCocoonPager.getStartIndex();
                 List l = (List)luceneCocoonPager.next();
                 Iterator i = l.iterator();
  @@ -240,6 +249,4 @@
         </para>
       </content>
     </page>
  -
   </xsp:page>
  -
  
  
  
  1.4       +20 -13    xml-cocoon2/src/webapp/samples/search/search-index.xsp
  
  Index: search-index.xsp
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/search/search-index.xsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- search-index.xsp	13 Jul 2002 18:43:22 -0000	1.3
  +++ search-index.xsp	14 Jul 2002 19:19:18 -0000	1.4
  @@ -98,7 +98,9 @@
       
       <title>Cocoon XML Search Interface</title>
       <content>
  -      <a href="http://jakarta.apache.org/lucene/"><img border="0" alt="Lucene
Logo" src="images/lucene_green_300.gif"/></a>
  +      <a href="http://jakarta.apache.org/lucene/">
  +        <img border="0" alt="Lucene Logo" src="images/lucene_green_300.gif"/>
  +      </a>
         <para>
           <small>
             <a href="../">Welcome</a> |
  @@ -160,24 +162,31 @@
               
               // do the search, search results are available in hits
               hits = search( queryString );
  -            luceneCocoonPager = new LuceneCocoonPager( hits );
  -            if (startIndex != null &amp;&amp; pageLength != null) {
  -              luceneCocoonPager.setStartIndex( startIndex.intValue() );
  -              luceneCocoonPager.setCountOfHitsPerPage( pageLength.intValue() );
  +            if (hits != null) {
  +              luceneCocoonPager = new LuceneCocoonPager( hits );
  +              if (startIndex != null &amp;&amp; pageLength != null) {
  +                luceneCocoonPager.setStartIndex( startIndex.intValue() );
  +                luceneCocoonPager.setCountOfHitsPerPage( pageLength.intValue() );
  +              }
  +              <xsp:content>
  +                Total Hits: <xsp:expr>hits.length()</xsp:expr>
  +              </xsp:content>
  +            } else {
  +              luceneCocoonPager = null;
  +              <xsp:content>
  +                No hits!
  +              </xsp:content>
               }
  -            <xsp:content>
  -              Total Hits: <xsp:expr>hits.length()</xsp:expr>
  -            </xsp:content>
             }
           </xsp:logic>
         </para>
         <para>
           <table width="90%" cellpadding="4" border="1">
  -          <tr>
  -            <td>Score</td><td>Count</td><td>URL</td>
  -          </tr>
             <xsp:logic>
               if (luceneCocoonPager!= null &amp;&amp; luceneCocoonPager.hasNext())
{
  +              <tr>
  +                <td>Score</td><td>Count</td><td>URL</td>
  +              </tr>
                 int counter = luceneCocoonPager.getStartIndex();
                 List l = (List)luceneCocoonPager.next();
                 Iterator i = l.iterator();
  @@ -240,6 +249,4 @@
         </para>
       </content>
     </page>
  -
   </xsp:page>
  -
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message