Re: Implementing a basic search for my website

2017-02-21 Thread Carlo Ascani
Thank you for all the answers! Given that I am implementing this for a demo purpose, I do not care about performances. I think I am going to do the 2 queries approach for the demo, then I would use a FTS engine in the future. Thanks a lot Carlo Il giorno martedì 21 febbraio 2017 02:09:46

Re: Implementing a basic search for my website

2017-02-20 Thread Shawn Milochik
If you want a pre-rolled solution, just use Django-haystack. It'll do exactly what you want. If you want to create your own to avoid the dependency on additional libraries and backend (you'll need something like Elasticsearch), that's easy also. Let me know if you do. I have some sample code

Re: Implementing a basic search for my website

2017-02-20 Thread Melvyn Sopacua
Hi Carlo, On Monday 20 February 2017 07:33:08 Carlo Ascani wrote: > class ASearch(ListView): > model = A > template_name = 'search_result.html' > > def get_context_data(self, **kwargs): > context = super(A, self).get_context_data(**kwargs) > results = A.objects.all()

Re: Implementing a basic search for my website

2017-02-20 Thread ludovic coues
You can split your query set in two. First search elements with both elements then elements with only one. Obviously, that's two request, so there might be better way to handle the problem. On 20 Feb 2017 4:33 p.m., "Carlo Ascani" wrote: > Hi all, > I am just trying to

Implementing a basic search for my website

2017-02-20 Thread Carlo Ascani
Hi all, I am just trying to add a search funcionality to my frontend. I know it is a huge topic, so sorry my n00bih questions. I have a model A class A(models.Model): roles = models.ManyToManyField(B) location = models.ForeignKey(C) ... These 2 fields are the only fields I care