X-Git-Url: http://git.indexdata.com/?p=simpleserver-moved-to-github.git;a=blobdiff_plain;f=SimpleServer.xs;h=abd5850751a9cc0a1fd7069df77d9f84ae152048;hp=285572644ae7b5347e3c0ab11ff8aa0460f309e4;hb=HEAD;hpb=83b87dd4d102d865215d623b59f7ede2be521c1b diff --git a/SimpleServer.xs b/SimpleServer.xs index 2855726..abd5850 100644 --- a/SimpleServer.xs +++ b/SimpleServer.xs @@ -1,5 +1,5 @@ /* This file is part of simpleserver. - * Copyright (C) 2000-2013 Index Data. + * Copyright (C) 2000-2015 Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -482,7 +482,7 @@ static SV *rpn2perl(Z_RPNStructure *s) case Z_Operator_and: type = "Net::Z3950::RPN::And"; break; case Z_Operator_or: type = "Net::Z3950::RPN::Or"; break; case Z_Operator_and_not: type = "Net::Z3950::RPN::AndNot"; break; - case Z_Operator_prox: fatal("proximity not yet supported"); + case Z_Operator_prox: type = "Net::Z3950::RPN::Prox"; break; default: fatal("unknown RPN operator %d", (int) c->roperator->which); } sv = newObject(type, (SV*) (av = newAV())); @@ -492,6 +492,21 @@ static SV *rpn2perl(Z_RPNStructure *s) if ((tmp = rpn2perl(c->s2)) == 0) return 0; av_push(av, tmp); + if (c->roperator->which == Z_Operator_prox) { + Z_ProximityOperator prox = *c->roperator->u.prox; + HV *hv; + tmp = newObject("Net::Z3950::RPN::Prox::Attributes", (SV*) (hv = newHV())); + setMember(hv, "exclusion", newSViv(*prox.exclusion)); + setMember(hv, "distance", newSViv(*prox.distance)); + setMember(hv, "ordered", newSViv(*prox.ordered)); + setMember(hv, "relationType", newSViv(*prox.relationType)); + if (prox.which == Z_ProximityOperator_known) { + setMember(hv, "known", newSViv(*prox.u.known)); + } else { + setMember(hv, "zprivate", newSViv(*prox.u.zprivate)); + } + av_push(av, tmp); + } return sv; } @@ -1002,6 +1017,11 @@ int bend_search(void *handle, bend_search_rr *rr) rr->extra_response_data = odr_strdupn(rr->stream, ptr, len); } + temp = hv_fetch(href, "ESTIMATED" "_HIT_" "COUNT", 19, 0); + if (temp) + { + rr->estimated_hit_count = SvIV(*temp); + } hv_undef(href); av_undef(aref);