#include "config.hpp"
#include "filter_zoom.hpp"
#include <yaz/zoom.h>
+#include <yaz/yaz-version.h>
#include <yaz/srw.h>
#include <metaproxy/package.hpp>
#include <metaproxy/util.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
+#include <yaz/ccl_xml.h>
#include <yaz/ccl.h>
#include <yaz/rpn2cql.h>
+#include <yaz/rpn2solr.h>
#include <yaz/pquery.h>
#include <yaz/cql.h>
#include <yaz/oid_db.h>
bool use_turbomarc;
bool piggyback;
CCL_bibset ccl_bibset;
- Searchable();
+ Searchable(CCL_bibset base);
~Searchable();
};
class Zoom::Backend : boost::noncopyable {
std::string torus_url;
std::map<std::string,std::string> fieldmap;
std::string xsldir;
+ CCL_bibset bibset;
};
}
}
if (*error >= ZOOM_ERROR_CONNECT)
{
// turn ZOOM diagnostic into a Bib-1 2: with addinfo=zoom err msg
- yaz_log(YLOG_LOG, "msg=%s", msg);
*error = YAZ_BIB1_TEMPORARY_SYSTEM_ERROR;
if (addinfo)
- {
- yaz_log(YLOG_LOG, "addinfo=%s", *addinfo);
*addinfo = msg;
- }
}
}
}
return ZOOM_connection_option_get(m_connection, name);
}
-yf::Zoom::Searchable::Searchable()
+yf::Zoom::Searchable::Searchable(CCL_bibset base)
{
piggyback = true;
use_turbomarc = true;
- ccl_bibset = ccl_qual_mk();
+ ccl_bibset = ccl_qual_dup(base);
}
yf::Zoom::Searchable::~Searchable()
yf::Zoom::Impl::Impl()
{
+ bibset = ccl_qual_mk();
}
yf::Zoom::Impl::~Impl()
{
+ ccl_qual_rm(&bibset);
}
yf::Zoom::SearchablePtr yf::Zoom::Impl::parse_torus(const xmlNode *ptr1)
continue;
if (!strcmp((const char *) ptr2->name, "layer"))
{
- Zoom::SearchablePtr s(new Searchable);
+ Zoom::SearchablePtr s(new Searchable(bibset));
const xmlNode *ptr3 = ptr2;
for (ptr3 = ptr3->children; ptr3; ptr3 = ptr3->next)
attr->name));
}
}
+ else if (!strcmp((const char *) ptr->name, "cclmap"))
+ {
+ const char *addinfo = 0;
+ ccl_xml_config(bibset, ptr, &addinfo);
+ }
else if (!strcmp((const char *) ptr->name, "fieldmap"))
{
const struct _xmlAttr *attr;
if (cql_field.length())
fieldmap[cql_field] = ccl_field;
}
- else if (!strcmp((const char *) ptr->name, "records"))
- {
- yaz_log(YLOG_WARN, "records ignored!");
- }
else
{
throw mp::filter::FilterException
!strcmp(element_set_name, "pz2"))
{
if (b->sptr->request_syntax.length())
- {
syntax_name = b->sptr->request_syntax.c_str();
- enable_pz2_transform = true;
- }
+ enable_pz2_transform = true;
}
else
{
assert(pqf_wrbuf);
if (b->get_option("sru"))
{
- cql_transform_t cqlt = cql_transform_create();
+ int status = 0;
Z_RPNQuery *zquery;
- WRBUF wrb = wrbuf_alloc();
- int status;
-
zquery = p_query_rpn(odr, wrbuf_cstr(pqf_wrbuf));
- status = cql_transform_rpn2cql_wrbuf(cqlt, wrb, zquery);
-
- cql_transform_close(cqlt);
-
+ WRBUF wrb = wrbuf_alloc();
+
+ if (!strcmp(b->get_option("sru"), "solr"))
+ {
+ solr_transform_t cqlt = solr_transform_create();
+
+ status = solr_transform_rpn2solr_wrbuf(cqlt, wrb, zquery);
+
+ solr_transform_close(cqlt);
+ }
+ else
+ {
+ cql_transform_t cqlt = cql_transform_create();
+
+ status = cql_transform_rpn2cql_wrbuf(cqlt, wrb, zquery);
+
+ cql_transform_close(cqlt);
+ }
if (status == 0)
{
yaz_log(YLOG_LOG, "search CQL: %s", wrbuf_cstr(wrb));
b->search_cql(wrbuf_cstr(wrb), &hits, &error, &addinfo);
}
-
+
wrbuf_destroy(wrb);
wrbuf_destroy(pqf_wrbuf);
if (status)
{
apdu_res =
odr.create_searchResponse(apdu_req, YAZ_BIB1_MALFORMED_QUERY,
- "can not convert from RPN to CQL");
+ "can not convert from RPN to CQL/SOLR");
package.response() = apdu_res;
return;
}