So I am trying to add a very simple search bar for my models. Here is my models file:
db = DAL('sqlite://storage.sqlite',
pool_size=1, check_reserved=['all'],
migrate_enabled=True, lazy_tables=True)
from gluon.tools import Auth
auth = Auth(db)
auth.define_tables(username=False, signature=False)
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
db.define_table('chat',
Field('me_from'),
Field('me_body', 'text'),
Field('me_html', 'text'),
)
STORE_TYPE = ['Department store', 'Discount store', 'Warehouse store', 'Hardware store', 'Boutique']
db.define_table('employee',
Field('first_name'),
Field('last_name'),
Field('store_name'),
Field('store_type', requires=IS_IN_SET(STORE_TYPE)),
Field('zip_code'),
auth.signature)
db.employee.first_name.requires = IS_NOT_EMPTY()
db.employee.last_name.requires = IS_NOT_EMPTY()
db.employee.store_name.requires = IS_NOT_EMPTY()
db.employee.store_type.requires = IS_NOT_EMPTY()
db.employee.zip_code.requires = IS_NOT_EMPTY()
I was looking at the hastack plugin for web2py https://github.com/mdipierro/web2py-haystack. I am not sure how I would integrate elasticsearch with haystack since it isn't listed on the supported backends.
From the table employee I want to create searchable indexes for the fields store_name, store_type, zip_code.
I want to create a separate view something like default/search that just has a search bar with these fields. If someone could tell me how to do this that would be great? Also please tell me what I would need to add/change in the models and views.