From: <bma...@ca...> - 2002-07-09 08:27:00
|
Hi, Thank you for your last help. Now I'm conecting to Ibermarc servers without problems. But there is another problem that I don't know how to resolve. I want to retrieve a number of records form the resultset, for example, 1000 records. They are not all present in my Searchable instance, and I want to make it present. I put it present, with the fetchRecords metod, but when I'm going to retrieve information, there is a moment that the value of PresentResponse_type.presentStatus is 5, and I can't obtain the records that I want to retrieve. I have tried to put the default_present_chunk_size to this number (Ex:1000), but I have obtained the same result : there is no possible to obtain this records, and a PresentResponse_type.presentStatus of 5. But if try to retrieve little resultsets, with 50 or 100 records, I have no problems. Now I'm using this code : In a future I want to use the PresentResponse_type class to the control of the records to make present, but now I don't do it, I use a variable. The part that I think maybe wrong are this two lines: presentRecord = s.fetchRecords(st.getTaskIdentifier(),inicial,servidor.getNumeroResultadosMaximo(),150000); frag = st.getFragment(inicial,servidor.getNumeroResultadosMaximo()); But this is the source-------------------> Z3950Origin s = new Z3950Origin(); //the searchable object. p.put("charset", "ISO-8859-1"); //filling the properties and initializing p.put("service_short_name","busqueda"); p.put("service_long_name","busqueda"); p.put("default_element_set_name","F"); p.put("default_present_chunk_size","1000"); s.init(p); IRQuery e = new IRQuery(); e.hints = new Hashtable(); e.hints.put("record_syntax", servidor.getFormato()); //servidor is a class that I use with values of the servers. Formato is the format of the record_syntax. e.collections = new Vector(); for (int i = 0; i < servidor.getBbdd().length ; i++){ e.collections.add(servidor.getBbdd(i)); //here I add the different databases to connect. } e.query = new PrefixString(crearQueryBusqueda(datosBusqueda));//now I construct the RPN query Z3950SearchTask st = (Z3950SearchTask) s.createTask(e, null, all_observers ); st.evaluate(100000); System.err.println("Private task status: "+st.lookupPrivateStatusCode(st.getPrivateTaskStatusCode())); InformationFragment frag[] = new InformationFragment[]{}; PresentResponse_type presentRecord = null; boolean tareaAcabada = false; boolean hayResultado = true; int inicial=1; int contador=0; Vector vResultado = new Vector(); while (!tareaAcabada){ //here I fetch the records and retrieve it. if (st.getFragmentCount() > (servidor.getNumeroResultadosMaximo()*(contador+1))) { presentRecord = s.fetchRecords(st.getTaskIdentifier(),inicial,servidor.getNumeroResultadosMaximo(),150000); frag = st.getFragment(inicial,servidor.getNumeroResultadosMaximo()); inicial = inicial + servidor.getNumeroResultadosMaximo(); contador++; } else if (st.getFragmentCount() > 0){ //here I fetch the records and retrieve it. presentRecord = s.fetchRecords(st.getTaskIdentifier(),inicial,(st.getFragmentCount() - contador*servidor.getNumeroResultadosMaximo()),150000); frag = st.getFragment(inicial,st.getFragmentCount() - contador*servidor.getNumeroResultadosMaximo()); tareaAcabada=true; }else { //No results!!! System.out.println("No hay resultados para esta query"); tareaAcabada=true; hayResultado = false; } if ((presentRecord.presentStatus.intValue() == 0)&& (hayResultado)) { for (int i = 0; i < frag.length ; i++){ vResultado.add(frag[i]); } }else{ System.out.println("No se ha podido recuperar este bloque: " + presentRecord.presentStatus.intValue()); } Is possible that using the chunk_size I will have the 1000 records present and that I doesn't need to do all this? Thanks in advance, Bartolomé Martínez. |