use of com.k_int.hss.HeterogeneousSetOfSearchable in project opentheso by miledrousset.
the class TestRecursive method totalOfNotices.
private int totalOfNotices(ArrayList<String> lisIds) {
int total = 0;
Properties p = new Properties();
p.put("CollectionDataSourceClassName", "com.k_int.util.Repository.XMLDataSource");
p.put("RepositoryDataSourceURL", "file:" + "/Users/Miled/NetBeansProjects/opentheso/src/main/webapp/repositories.xml");
p.put("XSLConverterConfiguratorClassName", "com.k_int.IR.Syntaxes.Conversion.XMLConfigurator");
p.put("ConvertorConfigFile", "/Users/Miled/NetBeansProjects/opentheso/src/main/webapp/SchemaMappings.xml");
Searchable federated_search_proxy = new HeterogeneousSetOfSearchable();
federated_search_proxy.init(p);
try {
IRQuery e = new IRQuery();
// e.collections = new Vector<String>();
e.collections.add("KOHA/biblios");
e.hints.put("default_element_set_name", "f");
e.hints.put("small_set_setname", "f");
e.hints.put("record_syntax", "unimarc");
for (String idConcept : lisIds) {
e.query = new PrefixString((new StringBuilder("@attrset bib-1 @attr 1=Koha-Auth-Number \"")).append(AsciiUtils.convertNonAscii("" + idConcept)).append("\"").toString());
SearchTask st = federated_search_proxy.createTask(e, null);
st.evaluate(5000);
total = total + st.getTaskResultSet().getFragmentCount();
}
} catch (TimeoutExceededException | SearchException srch_e) {
srch_e.printStackTrace();
}
return total;
}
use of com.k_int.hss.HeterogeneousSetOfSearchable in project opentheso by miledrousset.
the class SelectedTerme method majNoticeZ3950.
private void majNoticeZ3950() {
// ResourceBundle bundlePref = getBundlePref();
if (user.getNodePreference().isZ3950actif()) {
try {
Properties p = new Properties();
p.put("CollectionDataSourceClassName", "com.k_int.util.Repository.XMLDataSource");
p.put("RepositoryDataSourceURL", "file:" + user.getNodePreference().getPathNotice1());
p.put("XSLConverterConfiguratorClassName", "com.k_int.IR.Syntaxes.Conversion.XMLConfigurator");
p.put("ConvertorConfigFile", user.getNodePreference().getPathNotice2());
Searchable federated_search_proxy = new HeterogeneousSetOfSearchable();
federated_search_proxy.init(p);
try {
IRQuery e = new IRQuery();
// e.collections = new Vector<String>();
e.collections.add(user.getNodePreference().getCollectionAdresse());
e.hints.put("default_element_set_name", "f");
e.hints.put("small_set_setname", "f");
e.hints.put("record_syntax", "unimarc");
e.query = new PrefixString((new StringBuilder("@attrset bib-1 @attr 1=Koha-Auth-Number \"")).append(AsciiUtils.convertNonAscii("" + idC)).append("\"").toString());
SearchTask st = federated_search_proxy.createTask(e, null);
st.evaluate(5000);
nbNotices = st.getTaskResultSet().getFragmentCount();
st.destroyTask();
federated_search_proxy.destroy();
for (NodeFusion nf : getFusions()) {
if (nf.getIdConcept1().equals(idC)) {
String idTe = new TermHelper().getIdTermOfConcept(connect.getPoolConnexion(), nf.getIdConcept2(), idTheso);
nbNotices += getNotice(idTe);
}
}
} catch (TimeoutExceededException | SearchException srch_e) {
// srch_e.printStackTrace();
}
urlNotice = user.getNodePreference().getNoticeUrl();
try {
// String url_notices = "http://catalogue.frantiq.fr/cgi-bin/koha/opac-search.pl?idx=su%2Cwrdl&q=terme&idx=kw&idx=kw&sort_by=relevance&do=OK";
urlNotice = urlNotice.replace("terme", URLEncoder.encode("" + idC, user.getNodePreference().getUrlEncode()));
} catch (UnsupportedEncodingException ex) {
// Logger.getLogger(SelectedTerme.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (Exception e) {
}
}
}
use of com.k_int.hss.HeterogeneousSetOfSearchable in project opentheso by miledrousset.
the class SelectedTerme method getNbNoticesOfBranch.
public String getNbNoticesOfBranch() {
// ResourceBundle bundlePref = getBundlePref();
int total = 0;
if (totalNoticesOfBranch.isEmpty()) {
if (user.getNodePreference().isZ3950actif()) {
ConceptHelper conceptHelper = new ConceptHelper();
ArrayList<String> lisIds = new ArrayList();
lisIds = conceptHelper.getIdsOfBranch(connect.getPoolConnexion(), idC, idTheso, lisIds);
Properties p = new Properties();
p.put("CollectionDataSourceClassName", "com.k_int.util.Repository.XMLDataSource");
p.put("RepositoryDataSourceURL", "file:" + user.getNodePreference().getPathNotice1());
p.put("XSLConverterConfiguratorClassName", "com.k_int.IR.Syntaxes.Conversion.XMLConfigurator");
p.put("ConvertorConfigFile", user.getNodePreference().getPathNotice2());
Searchable federated_search_proxy = new HeterogeneousSetOfSearchable();
federated_search_proxy.init(p);
try {
IRQuery e = new IRQuery();
// e.collections = new Vector<String>();
e.collections.add(user.getNodePreference().getCollectionAdresse());
e.hints.put("default_element_set_name", "f");
e.hints.put("small_set_setname", "f");
e.hints.put("record_syntax", "unimarc");
for (String idConcept : lisIds) {
e.query = new PrefixString((new StringBuilder("@attrset bib-1 @attr 1=Koha-Auth-Number \"")).append(AsciiUtils.convertNonAscii("" + idConcept)).append("\"").toString());
SearchTask st = federated_search_proxy.createTask(e, null);
st.evaluate(5000);
total = total + st.getTaskResultSet().getFragmentCount();
st.destroyTask();
}
federated_search_proxy.destroy();
} catch (TimeoutExceededException | SearchException srch_e) {
srch_e.printStackTrace();
}
totalNoticesOfBranch = "" + total;
}
}
return totalNoticesOfBranch;
}
use of com.k_int.hss.HeterogeneousSetOfSearchable in project opentheso by miledrousset.
the class SelectedTerme method getNotice.
/**
* *
* Fin des nouvelles fonctions
*/
/**
* ************************************ GETTERS SETTERS
* *************************************
*/
/**
* Retourne le nombre de notice pour un terme passé en paramètre
*
* @param idTe
*/
private int getNotice(String idTe) {
// ResourceBundle bundlePref = getBundlePref();
int nbNoticesT = 0;
if (user.getNodePreference().isZ3950actif()) {
Properties p = new Properties();
p.put("CollectionDataSourceClassName", "com.k_int.util.Repository.XMLDataSource");
p.put("RepositoryDataSourceURL", "file:" + user.getNodePreference().getPathNotice1());
p.put("XSLConverterConfiguratorClassName", "com.k_int.IR.Syntaxes.Conversion.XMLConfigurator");
p.put("ConvertorConfigFile", user.getNodePreference().getPathNotice2());
Searchable federated_search_proxy = new HeterogeneousSetOfSearchable();
federated_search_proxy.init(p);
try {
IRQuery e = new IRQuery();
// e.collections = new Vector<String>();
e.collections.add(user.getNodePreference().getCollectionAdresse());
e.hints.put("default_element_set_name", "f");
e.hints.put("small_set_setname", "f");
e.hints.put("record_syntax", "unimarc");
e.query = new PrefixString((new StringBuilder("@attrset bib-1 @attr 1=Koha-Auth-Number \"")).append(AsciiUtils.convertNonAscii("" + idTe)).append("\"").toString());
SearchTask st = federated_search_proxy.createTask(e, null);
st.evaluate(5000);
nbNoticesT = st.getTaskResultSet().getFragmentCount();
st.destroyTask();
federated_search_proxy.destroy();
} catch (TimeoutExceededException | SearchException srch_e) {
srch_e.printStackTrace();
}
}
return nbNoticesT;
}
use of com.k_int.hss.HeterogeneousSetOfSearchable in project opentheso by miledrousset.
the class ExportTxtHelper method totalOfNotices.
/**
* fonction temporaire qui ne marche qu'avec Koha
*/
private int totalOfNotices(String idConcept) {
int tot = 0;
if (nodePreference == null) {
return 0;
}
if (nodePreference.isZ3950actif()) {
Properties p = new Properties();
p.put("CollectionDataSourceClassName", "com.k_int.util.Repository.XMLDataSource");
p.put("RepositoryDataSourceURL", "file:" + nodePreference.getPathNotice1());
p.put("XSLConverterConfiguratorClassName", "com.k_int.IR.Syntaxes.Conversion.XMLConfigurator");
p.put("ConvertorConfigFile", nodePreference.getPathNotice2());
Searchable federated_search_proxy = new HeterogeneousSetOfSearchable();
federated_search_proxy.init(p);
try {
IRQuery e = new IRQuery();
// e.collections = new Vector<String>();
e.collections.add("KOHA/biblios");
e.hints.put("default_element_set_name", "f");
e.hints.put("small_set_setname", "f");
e.hints.put("record_syntax", "unimarc");
e.query = new PrefixString((new StringBuilder("@attrset bib-1 @attr 1=Koha-Auth-Number \"")).append(AsciiUtils.convertNonAscii("" + idConcept)).append("\"").toString());
SearchTask st = federated_search_proxy.createTask(e, null);
st.evaluate(5000);
tot = st.getTaskResultSet().getFragmentCount();
st.destroyTask();
federated_search_proxy.destroy();
} catch (TimeoutExceededException | SearchException srch_e) {
// srch_e.printStackTrace();
}
}
return tot;
}
Aggregations