Mercurial > hg > ZopePubmanConnector
changeset 19:38ff05179d71
search got extra perameter searchkeys
author | dwinter |
---|---|
date | Wed, 26 Jun 2013 16:48:59 +0200 |
parents | da890cb0fd04 |
children | c91cfc8c3603 |
files | zopePubmanConnector.py |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/zopePubmanConnector.py Wed Jun 26 16:02:02 2013 +0200 +++ b/zopePubmanConnector.py Wed Jun 26 16:48:59 2013 +0200 @@ -172,7 +172,7 @@ return ret - def search(self,values={},exact=False,limit=None,contexts=None): + def search(self,values={},exact=False,limit=None,contexts=None,resultWithContext=False,sortKeys="escidoc.any-dates"): """search pubman @values map mit field->value @return map mit escidocId -> XML-formatted snippeds @@ -184,7 +184,9 @@ cn = self.connectorString+"cqlQuery=%s&" - cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" + #cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending" + #cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.property.creation-date&sortOrder=descending" + cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys="+sortKeys+"&sortOrder=descending" if limit: cn+="&maximumRecords=%s"%limit @@ -254,7 +256,13 @@ for citation in citations: objId = citation.get('objid') text = citation.find(citationxpath) - ret[objId]=text.text + + if resultWithContext: + ctxPath=".//escidocItem:properties/srel:context" + ctx = citation.find(ctxPath,ns) + ret[objId]=(text.text,ctx.get('objid')) + else: + ret[objId]=text.text return ret