Package org.jzkit.search.util.RecordModel

Examples of org.jzkit.search.util.RecordModel.ExplicitRecordFormatSpecification


        record_schema = "meta" ;

      String query = params.get(OP_SR_QUERY);


      ExplicitRecordFormatSpecification display_spec = new ExplicitRecordFormatSpecification("xml","","f");


            if(Log.isDebugEnabled(Geonet.SRU))
                Log.debug(Geonet.SRU,"getting reference to search session factory");


      // TODO: would be nice to move this to init method but I dont know where to get the context from there..

      // not supported by Geonetwork modules URL layout schema
      // TODO: collections could also be mapped to GeoNetwork categories?
      LandscapeSpecification landscape = new SimpleLandscapeSpecification("geonetwork");

      DefaultContextSetCQLString model =  new DefaultContextSetCQLString(query, "geo", "cql", "geo");
      // we assume that all incoming queries are from the geo (attributes,structure) and cql (relation) context sets
      // if we set this to false we have to write a crosswalk for bib-1,dc....
      //model.setForceContextSet(true);

      SearchSessionFactory search_session_factory = getSearchSession(context);


            if(Log.isDebugEnabled(Geonet.SRU))
                Log.debug(Geonet.SRU,"Calling search_session_factory.getResultsPageFor");
      StatelessSearchResultsPageDTO result = search_session_factory.getResultsPageFor(null,
          model,
          landscape,
          first_record,
          num_hits_per_page,
          request_spec,
          display_spec,
          null);
            if(Log.isDebugEnabled(Geonet.SRU))
                Log.debug(Geonet.SRU,"Call to getResultsPageFor completed : "+result);

      Element myresponse = new Element("sruresponse");
      response.addContent(myresponse);

      int num_records = 0;
      String res_id = "";
      long idle = 0;

      if ( ( result.records != null ) && ( result.records.length > 0 ) ) {
        DOMBuilder builder = new DOMBuilder();


        num_records = result.records.length;
        res_id = result.result_set_id;
        idle = result.result_set_idle_time ;

        for ( int i=0; i<result.records.length;i++ ) {

          Element elem = new Element("record");
          elem.setAttribute( new Attribute("recordPosition",""+first_record+i));

          ExplicitRecordFormatSpecification res = result.records[i].getFormatSpecification();

          // check if the format corresponds to what we are requesting
          if ( ! res.toString().equals(display_spec.toString()) ) {
            Log.error(Geonet.SRU, "error, format specification "+result.records[i].getFormatSpecification()+" does not correspond to "+display_spec+" :"+result.records[i].getOriginalObject() );


            addToDiag(elem, "info:srw/diagnostic/1/67", "Record not available in this schema", result.records[i].getOriginalObject().toString());
View Full Code Here


               Log.debug(Geonet.Z3950_SERVER, "Request for fragment start:"
                               + startingFragment + ", count:" + count);

               InformationFragment fragment[] = new InformationFragment[count];

               ExplicitRecordFormatSpecification rec_spec = new ExplicitRecordFormatSpecification("xml", null, "f");

               try {
                       // build fragment data
                       int from = startingFragment;
                       int to = startingFragment + count - 1;
View Full Code Here

    // get hold of JZKit SearchSession
    StatelessQueryService sqs = getQueryService(srvContext);

    LandscapeSpecification landscape = new SimpleLandscapeSpecification( collection_ids );
    ExplicitRecordFormatSpecification exp = null;

        if(Log.isDebugEnabled(Geonet.SEARCH_ENGINE))
            Log.debug(Geonet.SEARCH_ENGINE, "Starting remote search");

    String query_id = null;
View Full Code Here

    {
      StatelessQueryService sqs = getQueryService(srvContext);
      InformationFragment fragshtml[] = null;

      if (_html) {
        ExplicitRecordFormatSpecification htmlrfs = new ExplicitRecordFormatSpecification("html", null, "f");
        StatelessSearchResultsPageDTO res = sqs.getResultsPageFor(this.zinfo.getSetname(),this.zinfo.getQueryModel(),this.zinfo.getLandscape(),getFrom(),getTo(),def_html_request_spec,htmlrfs,null);
        fragshtml = res.records;
      }

      ExplicitRecordFormatSpecification rfs = new ExplicitRecordFormatSpecification("xml", null, "f");
      StatelessSearchResultsPageDTO res = sqs.getResultsPageFor(this.zinfo.getSetname(),this.zinfo.getQueryModel(),this.zinfo.getLandscape(),getFrom(),getTo(),def_request_spec,rfs,null);
      InformationFragment frags[] = res.records;

      // FIXME: we may not get all the records we want back sometimes!
      int fragsLength = 0;
View Full Code Here

  }

  public static ExplicitRecordFormatSpecification getSpec(OIDRegisterEntry entry, String esn, String profile)
  {
    if ( entry.getName().equals("usmarc") )
      return new ExplicitRecordFormatSpecification("iso2709:usmarc:"+esn);
    else if ( entry.getName().equals("ukmarc") )
      return new ExplicitRecordFormatSpecification("iso2709:ukmarc:"+esn);
    else if ( entry.getName().equals("grs-1") )
      return new ExplicitRecordFormatSpecification("grs-1:"+profile+":"+esn);
    else if ( entry.getName().equals("xml") )
      return new ExplicitRecordFormatSpecification("xml:null:"+esn);

    return null;
  }
View Full Code Here

TOP

Related Classes of org.jzkit.search.util.RecordModel.ExplicitRecordFormatSpecification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.