From a35ff73524728da76bb6346dbc3c5da136903d99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Tue, 24 Jun 2014 15:31:15 +0200 Subject: [PATCH 1/1] Utilisation des attributs. --- catalog.py | 12 ++++-------- profiles/default/catalog.xml | 2 +- profiles/default/toolset.xml | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/catalog.py b/catalog.py index da1e4cc..d353d6d 100644 --- a/catalog.py +++ b/catalog.py @@ -111,24 +111,20 @@ class DelegatedCatalog(Catalog) : Catalog.__init__(self, brains=brains) self.zcat = zcat - def getDelegatedIndexes(self) : - return ('Title', 'Description', 'SearchableText') # <= TODO virer cette ligne - return self.zcat.delegatedIndexes - def delegateSearch(self, query, plan) : ''' retours faux : None signifie : pas de délégation, il faut continuer à interroger les autres index. IISet() vide : pas de résultat lors de la délégation, on peut arrêter la recherche. ''' - indexes = set(plan).intersection(set(self.getDelegatedIndexes())) + indexes = set(plan).intersection(set(self.zcat.delegatedIndexes)) + if not indexes : + return None delegatedQuery = {} for i in indexes : delegatedQuery[i] = query.pop(i) plan.remove(i) - if not delegatedQuery : - return None - c = SolrConnection('http://localhost:8983/solr') + c = SolrConnection(self.zcat.solr_url) q =' AND '.join(['%s:"%s"' % item for item in delegatedQuery.items()]) resp = c.query(q, fields='id', rows=len(self)) c.close() diff --git a/profiles/default/catalog.xml b/profiles/default/catalog.xml index 10f32c2..41914e7 100644 --- a/profiles/default/catalog.xml +++ b/profiles/default/catalog.xml @@ -1,5 +1,5 @@ - + + class="Products.Plinn.catalog.CatalogTool"/>