Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching different fields of the same model without the '$ python manage.py buildwatson' command #29

Closed
marcelosalloum opened this issue Dec 20, 2013 · 4 comments

Comments

@marcelosalloum
Copy link

Hello guys,

I am developing a kind of a search bar with watson that allows some checkboxes to choose in which fields the database search will be performed.

Can I just specify it on the run or is it needed to tun the $ python manage.py buildwatson command again? Even if I had to build it again, wouldn't be an option, since my database is getting petty large it would consume some minutes, which is not desirable from the User's point of view.

Any hints on that?

@etianen
Copy link
Owner

etianen commented Dec 20, 2013

You can do this by creating a new search engine:

https://gist.github.com/etianen/060d1fe02d79f9bc39b5

On 20 December 2013 14:25, Marcelo Salloum dos Santos <
notifications@github.com> wrote:

Hello guys,

I am developing a kind of a search bar with watson that allows some
checkboxes to choose in which fields the database search will be performed.

Can I just specify it on the run or is it needed to tun the $ python
manage.py buildwatson
command again? Even if I had to build it again,
wouldn't be an option, since my database is getting petty large it would
consume some minutes, which is not desirable from the User's point of view.

Any hints on that?


Reply to this email directly or view it on GitHubhttps://github.com//issues/29
.

@marcelosalloum
Copy link
Author

Awesome, Dave! And how do I use that in my views files? Should I just try:

other_search_engine = SearchEngine("other_search_engine")
other_search_engine.search("search_term")

Cheers!

@etianen
Copy link
Owner

etianen commented Dec 20, 2013

You should create the other search engine in your models.py, or similar,
where it will be created once globally. You then register your models with
it as normal.

You then call other_search_engine.search() in your views, as normal.

On 20 December 2013 16:40, Marcelo Salloum dos Santos <
notifications@github.com> wrote:

Awesome, Dave! And how do I use that in my views files? Should I just try:

other_search_engine = SearchEngine("other_search_engine")
other_search_engine.search("search_term")

Cheers!


Reply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-31022765
.

@marcelosalloum
Copy link
Author

Great help Dave,

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants