-
Notifications
You must be signed in to change notification settings - Fork 75
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
Search results from trusted sites #95
base: master
Are you sure you want to change the base?
Conversation
@AdiChat Please review |
search/views.py
Outdated
def search_results_from_sites(request): | ||
keyword = request.GET['q'] | ||
keyword.replace(' ', '+') | ||
res = requests.get('https://google.com/search?q=' + keyword) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to get results for a particular keyword say linear search
from Wikipedia, then, the query should be linear search site:wikipedia.org
Kindly take a look into this.
search/views.py
Outdated
heading_list = [] | ||
tab_counts = min(50, len(links)) | ||
count = 0 | ||
l = ["wikipedia", "tutorialspoint"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trusted sites list should be placed at setting.py
.
search/views.py
Outdated
else: | ||
link_list.append(link) | ||
heading_list.append(links[i].text) | ||
keyword = keyword + '+stackoverflow' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the above search strategy and loop to unify this. 👍
cosmos_search/settings.py
Outdated
@@ -25,7 +25,7 @@ | |||
SECRET_KEY = config('SECRET_KEY') | |||
|
|||
# SECURITY WARNING: don't run with debug turned on in production! | |||
DEBUG = config('DEBUG', cast=bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not change this.
Nice work 👍 For the UI point of view, you may keep the style of external site results similar to the result from Cosmos. Additionally, you may fetch details for the result and display them under them as well for easy browsing. Currently, when there are no results from Cosmos, it returns the no results page and the external site result follows. You need to consider this scenario and also, consider the case of calculations for which there are no external site results. The titles for results are not correct. See results for Kindly take a look into this and make appropriate changes. 👍 |
@sarvanideekshitula Any update on this? You have made an important contribution which requires minor changes as stated above to make it perfect. If you facing any issues, kindly let us know and we will help you. Keep us updated on your progress. 👍 |
Great work 👍 Instead of "solution", use the text "see more". Move the results to a tab named "External". The current code results from Cosmos should be available at the tab "Code". The tabs must be under the search bar. This is required as the number of code results from Cosmos can be large in some cases. The default tab must be named "All" which will include both the results. This will be a minor UI change. Also, consider the no results page. Kindly take a look and make appropriate changes. 👍 |
Nice work 👍 The UI looks perfect. The issue is that we will be sending requests from a single IP due to which it will get blocked. The solution around this is to create a sitemap including the site description for our use. This can be done by searching the search term Kindly take a look at this and make appropriate changes. 👍 |
{% if result_val or not result%} | ||
{% include 'cosmos/calculator.html' %} | ||
{% endif %} | ||
<div id="All" class="tabcontent"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could remove this 'All' part, and add javascript to determine which part or whole need to be displayed.
In addition, all of result should be displayed by default should be better than.
<button class="tablinks" onclick="display(event, 'External')">External</button> | ||
</div> | ||
|
||
<script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move these scripts into block javascripts
(See header.html).
Checklist
develop
branch.Which issue does this PR fix?:
fixes: #91