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

Search results from trusted sites #95

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

sarvanideekshitula
Copy link
Contributor

Checklist

  • My branch is up-to-date with the upstream develop branch.
  • I have added necessary documentation (if appropriate).

Which issue does this PR fix?:
fixes: #91

@sarvanideekshitula
Copy link
Contributor Author

@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)
Copy link
Member

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"]
Copy link
Member

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'
Copy link
Member

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. 👍

@Shweta4321 Shweta4321 mentioned this pull request Mar 17, 2018
@@ -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)
Copy link

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.

@AdiChat
Copy link
Member

AdiChat commented Mar 17, 2018

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 linear search. Also, you must open links on a new tab and the links should be the links to the site but currently, it goes through Google google.com/url=....

Kindly take a look into this and make appropriate changes. 👍

@AdiChat
Copy link
Member

AdiChat commented Apr 4, 2018

@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. 👍

@AdiChat
Copy link
Member

AdiChat commented Apr 7, 2018

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. 👍

@AdiChat
Copy link
Member

AdiChat commented Apr 8, 2018

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 site:stackoverflow.com and storing all the results. We need to search our stored results to present the results to the user.

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">
Copy link

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>
Copy link

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).

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

Successfully merging this pull request may close these issues.

Include search results from trusted sites
4 participants