[Grok-dev] Trying to search with zc.catalog
Sebastian Ware
sebastian at urbantalk.se
Mon Jul 7 10:03:18 EDT 2008
Neither catalogs nor indexes are automatically added to an existing
application. Have you tried removing the app and adding it again.
Mvh Sebastian
7 jul 2008 kl. 13.55 skrev Peter Bengtsson:
> Hi, I've been following this:
> http://grok.zope.org/documentation/how-to/implementing-search
> with the exception that didn't use zc.catalog==1.1.1 but just
> zc.catalog.
>
> The indexes are set up like this:
>
> from grok import index
>
> class RecipeIndexes(grok.Indexes):
> grok.site(TheGrokWay)
> grok.context(IRecipe)
> grok.name('recipe_catalog')
> title = index.Text()
> ...more indexes
>
> The Search view looks like this:
> from hurry.query.query import Query, Text
> from hurry.query import Eq
>
> class Search(Master):
> grok.context(TheGrokWay)
> def update(self, q=None):
> if q:
> result = Query().searchResults(
> Eq(('recipe_catalog', 'title'), q)
> )
>
> print result or something fun with the results
>
>
>
> 2008-07-07T12:43:32 ERROR SiteError http://localhost:9080/thegrokway/search
> Traceback (most recent call last):
> File "/home/peterbe/buildout-eggs/tmpLjcktJ/
> zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/
> publish.py",
> line 133, in publish
> File "/home/peterbe/buildout-eggs/tmp_TGW-i/grok-0.12.1-py2.4.egg/
> grok/publication.py",
> line 45, in callObject
> File "/home/peterbe/buildout-eggs/tmpbJjpQ5/
> zope.app.publication-3.4.2-py2.4.egg/zope/app/publication/
> zopepublication.py",
> line 167, in callObject
> File "/home/peterbe/buildout-eggs/tmpLjcktJ/
> zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/
> publish.py",
> line 108, in mapply
> - __traceback_info__: <thegrokway.app.Search object at 0x97b93ec>
> File "/home/peterbe/buildout-eggs/tmpLjcktJ/
> zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/
> publish.py",
> line 114, in debug_call
> File "/home/peterbe/buildout-eggs/tmp_TGW-i/grok-0.12.1-py2.4.egg/
> grok/components.py",
> line 132, in __call__
> File "/home/peterbe/buildout-eggs/tmpLjcktJ/
> zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/
> publish.py",
> line 108, in mapply
> - __traceback_info__: <bound method Search.update of
> <thegrokway.app.Search object at 0x97b93ec>>
> File "/home/peterbe/buildout-eggs/tmpLjcktJ/
> zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/
> publish.py",
> line 114, in debug_call
> File "/home/peterbe/dev/GROK/TheGrokWay/src/thegrokway/app.py", line
> 221, in update
> result = Query().searchResults(
> File "/home/peterbe/buildout-eggs/hurry.query-0.9.2-py2.4.egg/hurry/
> query/query.py",
> line 20, in searchResults
> results = query.apply()
> File "/home/peterbe/buildout-eggs/hurry.query-0.9.2-py2.4.egg/hurry/
> query/query.py",
> line 144, in apply
> return self.getIndex().apply((self.value, self.value))
> File "/home/peterbe/buildout-eggs/hurry.query-0.9.2-py2.4.egg/hurry/
> query/query.py",
> line 133, in getIndex
> index = super(FieldTerm, self).getIndex()
> File "/home/peterbe/buildout-eggs/hurry.query-0.9.2-py2.4.egg/hurry/
> query/query.py",
> line 113, in getIndex
> catalog = zapi.getUtility(ICatalog, self.catalog_name)
> File "/home/peterbe/buildout-eggs/zope.component-3.4.0-py2.4.egg/
> zope/component/_api.py",
> line 207, in getUtility
> raise ComponentLookupError(interface, name)
> ComponentLookupError: (<InterfaceClass
> zope.app.catalog.interfaces.ICatalog>, 'recipe_catalog')
>
>
> --
> Peter Bengtsson,
> work www.fry-it.com
> home www.peterbe.com
> hobby www.issuetrackerproduct.com
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
More information about the Grok-dev
mailing list