From: Benoît Pin Date: Tue, 24 Jun 2014 13:31:15 +0000 (+0200) Subject: Utilisation des attributs. X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/commitdiff_plain/a35ff73524728da76bb6346dbc3c5da136903d99?ds=sidebyside;hp=-c Utilisation des attributs. --- a35ff73524728da76bb6346dbc3c5da136903d99 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"/>