Project

General

Profile

« Previous | Next » 

Revision 3055

Added by perry about 18 years ago

fix to docid overrides to handle an empty result set

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
807 807
        SpatialQuery sq = new SpatialQuery();
808 808
        Vector docids = sq.filterByBbox( _xmin, _ymin, _xmax, _ymax );
809 809
        logMetacat.info(" --- Spatial Query completed. Passing on the SQuery handler");
810
        logMetacat.warn("\n\n ******* after spatial query, we've got " + docids.size() + " docids \n\n");
810 811

  
811 812
        /*
812 813
         * Create an array matching docids
......
845 846
        /*
846 847
         * Pass the docids to the DBQuery contructor
847 848
         */
849
        // This is a hack to get the empty result set to show...
850
        // Otherwise dbquery sees no docidOverrides and does a full % percent query
851
        if (docids.size() == 0)
852
            docids.add("");
853

  
848 854
        DBQuery queryobj = new DBQuery(docids);
849 855
        queryobj.findDocuments(response, out, params, username, groupnames, sess_id);
850 856

  
src/edu/ucsb/nceas/metacat/DBQuery.java
85 85
    /** true if the metacat spatial option is installed **/
86 86
    private final boolean METACAT_SPATIAL = true;
87 87

  
88
    // MPTODO testing
88
    /** useful if you just want to grab a list of docids **/
89 89
    Vector docidOverride = new Vector();
90 90

  
91 91
    /**
......
312 312
        	 params.put("isModerator", new String[] {"true"});
313 313
         }
314 314

  
315
         //MPTODO testing
316
         //logMetacat.info("\n\n MPTODO \n\n " + xml.toString() + "\n\n");
317

  
318 315
         trans.transformXMLDocument(xml.toString(), "-//NCEAS//resultset//EN",
319 316
                                 "-//W3C//HTML//EN", qformat, out, params,
320 317
                                 sessionid);
......
451 448
      if ( this.docidOverride.size() == 0 ) {
452 449
          query = qspec.printSQL(useXMLIndex);
453 450
      } else {
454
          logMetacat.info("\n\n\n******************* docid override **************\n\n\n");
451
          logMetacat.info("\n\n\n*** docid override " + this.docidOverride.size() + "\n\n\n");
455 452
          StringBuffer queryBuffer = new StringBuffer( "SELECT docid,docname,doctype,date_created, date_updated, rev " );
456 453
          queryBuffer.append( " FROM xml_documents WHERE docid IN (" );
457 454
          for (int i = 0; i < docidOverride.size(); i++) {  

Also available in: Unified diff