Hi, I did small changes to the example in the book (ajax search),
@auth.requires_login() def searchtalab(): "an ajax wiki search page" return dict(form=FORM(INPUT(_id='keyword',_name='keyword', _onkeyup="ajax('callbacktalab', ['keyword'], 'target');")), target_div=DIV(_id='target')) @auth.requires_login() def callbacktalab(): "an ajax callback that returns a <ul> of links to wiki pages" query = db.talab.body.contains(request.vars.keyword) | db.talab.title.contains(request.vars.keyword) talabs = db(query).select( orderby=db.talab.on_date ) links = [A(n.on_date,' ...... ',( str(n.title) ) ,' .... ',( str(n.body) ) ,' .... ' , _href=URL('talab_r_search',args=n.id)) for n in talabs] return UL(*links) and it is working perfect. then I am trying to do the search, not only in one table , but to include the details tables, So, I wrote it as : @auth.requires_login() def searchtalabdetails(): "an ajax wiki search page" return dict(form=FORM(INPUT(_id='keyword',_name='keyword', _onkeyup="ajax('searchtalabdetails', ['keyword'], 'target');")), target_div=DIV(_id='target')) @auth.requires_login() def searchtalabdetails(): "an ajax callback that returns a <ul> of links to wiki pages" query = ( ((db.talab.id == db.talab_comment.talab_id) & (db.talab.id == db.talab_document.id)) & ( (db.talab.body.contains(request.vars.keyword)) | (db.talab.title.contains(request.vars.keyword)) |(db.talab_comment.body.contains(request.vars.keyword)) | (db.talab_document.doc_title.contains(request.vars.keyword)) ) ) talabs = db(query).select( orderby=db.talab.on_date ) links = [A(n.talab.on_date,' ...... ',( str(n.talab.title) ) ,' .... ',( str(n.talab.body) ) ,' .... ' , _href=URL('talab_r_search',args=n.talab.id)) for n in talabs] return UL(*links) but it gave me the error: <type 'exceptions.TypeError'> CONTAINS() takes exactly 3 arguments (2 given) VERSIONweb2py™(2, 0, 9, datetime.datetime(2012, 9, 13, 23, 51, 30), 'stable')TRACEBACK 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. Traceback (most recent call last): File "gluon/restricted.py", line 209, in restricted File "C:/Users/Toshiba/Desktop/web2py_209/web2py/applications/e_galya/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/e_galya/controllers/default.py>, line 1190, in <module> File "gluon/globals.py", line 186, in <lambda> File "gluon/tools.py", line 2809, in f File "C:/Users/Toshiba/Desktop/web2py_209/web2py/applications/e_galya/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/e_galya/controllers/default.py>, line 74, in searchtalabdetails File "gluon/dal.py", line 8766, in select File "gluon/dal.py", line 2094, in select File "gluon/dal.py", line 1581, in select File "gluon/dal.py", line 1444, in _select File "gluon/dal.py", line 1277, in expand File "gluon/dal.py", line 1160, in AND File "gluon/dal.py", line 1277, in expand File "gluon/dal.py", line 1163, in OR File "gluon/dal.py", line 1277, in expand File "gluon/dal.py", line 1163, in OR File "gluon/dal.py", line 1277, in expand File "gluon/dal.py", line 1163, in OR File "gluon/dal.py", line 1279, in expand TypeError: CONTAINS() takes exactly 3 arguments (2 given) What did i do wrong? Regards, Ashraf --