Implementing a search engine in web2py

79 views
Skip to first unread message

lokesh

unread,
Jul 5, 2014, 7:28:33 AM7/5/14
to web...@googlegroups.com
I'm using whoosh backend with plugin_haystack in my application.
But the search function is working only if there is an insert or update db statement in that function.
For instance :
def temp():
 db
.my_table.insert(my_row1="temporary data to test the search")
 rows
= db(index.search(my_row1="data to search"))
 
return dict(rows=rows)

this returns the newly inserted row as the search result. But after that if I do this, it doesn't return any matching result,
def temp2():
 rows
= db(index.search(my_row1="data to search"))
 
return dict(rows=rows)

what could be the mistake here?

Massimo Di Pierro

unread,
Jul 7, 2014, 6:15:56 AM7/7/14
to web...@googlegroups.com
Can you tell us more about your setup? Do you have one server? Multiple processes? Did you try it form the web2py shell?

lokesh

unread,
Jul 7, 2014, 10:17:40 AM7/7/14
to web...@googlegroups.com
I have a single web2py instance running on my localhost. And I have defined these functions in a controller and displaying the obtained using their respective views. I'm testing them by opening appropriate urls likes localhost:8000/application/controller/function.
In first case it returns the just inserted row if it matches search results. And if I open the second function url after the first one it doesn't return any search results.

lokesh

unread,
Jul 8, 2014, 8:59:04 AM7/8/14
to web...@googlegroups.com
I have a single web2py instance running on my localhost. And I have defined these functions in a controller and displaying the obtained using their respective views. I'm testing them by opening appropriate urls likes localhost:8000/application/controller/function.
In first case it returns the just inserted row if it matches search results. And if I open the second function url after the first one it doesn't return any search results.
Reply all
Reply to author
Forward
0 new messages