Error when i want create ZSearchInterface

Hi,
when I want to use the Z Search Interface Product, I have an error.
This this the traceback

2020-10-12 17:29:21 ERROR [waitress:357][waitress] Exception while serving /www.fam-europe.fr/Posts/manage_addProduct/ZSQLMethods/manage_addZSearch
Traceback (most recent call last):
File "/home/zope/zope4/Zope-4.3/eggs/waitress-1.4.3-py3.7.egg/waitress/channel.py", line 349, in service
task.service()
File "/home/zope/zope4/Zope-4.3/eggs/waitress-1.4.3-py3.7.egg/waitress/task.py", line 169, in service
self.execute()
File "/home/zope/zope4/Zope-4.3/eggs/waitress-1.4.3-py3.7.egg/waitress/task.py", line 439, in execute
app_iter = self.channel.server.application(environ, start_response)
File "/home/zope/zope4/Zope-4.3/src/ZPublisher/httpexceptions.py", line 30, in call
return self.application(environ, start_response)
File "/home/zope/zope4/Zope-4.3/eggs/Paste-3.3.0-py3.7.egg/paste/translogger.py", line 69, in call
return self.application(environ, replacement_start_response)
File "/home/zope/zope4/Zope-4.3/src/ZPublisher/WSGIPublisher.py", line 359, in publish_module
response = _publish(request, new_mod_info)
File "/home/zope/zope4/Zope-4.3/src/ZPublisher/WSGIPublisher.py", line 262, in publish
bind=1)
File "/home/zope/zope4/Zope-4.3/src/ZPublisher/mapply.py", line 85, in mapply
return debug(object, args, context)
File "/home/zope/zope4/Zope-4.3/src/ZPublisher/WSGIPublisher.py", line 63, in call_object
return obj(*args)
File "/home/zope/zope4/Zope-4.3/lib/python3.7/site-packages/Shared/DC/ZRDB/Search.py", line 39, in manage_addZSearch
raise ValueError('No searchable objects were selected')
ValueError: No searchable objects were selected

Everyone can help me?
Great

ZSearchInterface creates a (user) interface specialized for a "searchable object". Concrete: it asks the searchable object for its input parameters and its result fields and creates a form for the input parameters and a view for the result parameters.
The error message above indicates that the create has not seen the "searchable object" information -- either because you did not specify it or because the information was lost due to some bug.

Install Products.SiteErrorLog (if this is not already installed); create an error_log object (from the above product; if not already present). The error_log gives you detailed information about requests which failed due to an exception. In the case above, could could inspect the request to check whether the "searchable object" information is present or not.

I tried to add a "Search Interface" via ZMI and there is a select list for the searchable objects, which is empty.

The above error message is a result when you try to create this form without selecting a "searchable object".

It looks like, you need to change into a folder with a ZSQLMethod or create one.

When you do this, there is something to select from and you can create a "search form".

Ideally, the front-end would only allow to submit forms, which produce a valid result, ie do not allow to submit a form which lacks some required values.

Update
Looks like you can also select a ZCatalog as searchable objects!

@airod - What is your use case? Do you really want to search in a MySQL database? Or in the ZODB?

Another update
This function was not tested for Python 3 and is currently broken, see

The ZSearchInterface supports only a limited set of "searchable object" types (when I remember right ZSQLMethods and ZCatalog objects). The selection list should enumerate all such objects the ZSearchInterface sees in the context of its invocation (including at least the invocation Folder). Should there be such a searchable object and the list is nevertheless empty, you see a bug.

1 Like

Thanks, Dieter! I figured that out, already - see updates above.

Anyway, currently, the form generator does not work in Python 3, see above linked GitHub issue.

Thank you for your answers. I will skip it from Z Search Interfaces for now