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

relevance of search results #55

Open
Bhupesh-V opened this issue Oct 11, 2019 · 5 comments
Open

relevance of search results #55

Bhupesh-V opened this issue Oct 11, 2019 · 5 comments
Assignees
Labels
bug 🐛 Something isn't working hacktoberfest help wanted 🙌 Extra attention is needed

Comments

@Bhupesh-V
Copy link
Owner

Bhupesh-V commented Oct 11, 2019

Describe the bug
Currently if we search java tutorials, the search results are javascript tutorials.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://tutorialdb-app.herokuapp.com/search/?q=java
  2. Scroll down.
  3. See error.

Expected behavior
Relevant search results should appear, we have to give preference to Java tutorials instead of JavaScript.

Additional context
Maybe we need to add priorities to tags.

Issue raised by Daiyrbek Artelov on DEV.to

@Bhupesh-V Bhupesh-V added bug 🐛 Something isn't working help wanted 🙌 Extra attention is needed hacktoberfest labels Oct 11, 2019
@Bhupesh-V
Copy link
Owner Author

It seems that I am ordering the results based on their id instead of search text 😖
In the method search_query()

if category is not None:
        tutorials = Tutorial.objects.filter(
            (Q(title__icontains=query) | Q(tags__name__in=list_query))
            & Q(category__icontains=category)
        ).order_by('id').filter(publish=True).distinct()
    else:
        tutorials = Tutorial.objects.filter(
            (Q(title__icontains=query) | Q(tags__name__in=list_query))
        ).order_by('id').filter(publish=True).distinct()

removing .order_by('id') would probably fix the problem

@Bhupesh-V Bhupesh-V modified the milestone: v1.1.4 Oct 13, 2019
@bookRa
Copy link

bookRa commented Oct 24, 2019

Hey @Bhupesh-V if nobody's worked on this already, I'd be happy to!

@Bhupesh-V
Copy link
Owner Author

@bookRa you can work on this 👍

@bookRa
Copy link

bookRa commented Oct 25, 2019

@Bhupesh-V how do I spin up this app and use it locally with a database of tutorials? I've used python manage.py runserver to get it on my localhost. But whenever I add a link through "contribute," some corresponding tags are registered, but the actual links to the tutorials are missing. I cannot search for them

1
2
3
4

I would appreciate any advice, or step-by-step to working with the local database. Sorry if it's obvious but I don't have too much exp with Django framework 😅

@Animesh-Ghosh
Copy link
Collaborator

Animesh-Ghosh commented Oct 26, 2019

It's not a database issue as far as I know. We added a published field in the database model a while back.

@bookRa, you need to publish the added tutorial through the admin site. That will make the tutorial visible on the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working hacktoberfest help wanted 🙌 Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants