question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do we need the search_without_count() functions?

See original GitHub issue

I’m submitting a …

  • bug report
  • feature request

Current behavior:

We have many repetitive functions that I believe could be eliminated.

Expected behavior:

Fewer functions required to deliver the equivalent functionality.

Steps to reproduce: Our scrapers have:

When we do a search() we are not guaranteeing that we will deliver at least num_results results. If the upstream search engine only delivers 5 results then we will only return that many even if the caller has set num_results to 10. If the upstream search engine does not allow us to control how many results we can get then we are not breaking any guarantee if we deliver less than num_results. We are however guaranteeing that we will deliver no more than num_results.

So, why not have a default value for the num_results parameter (def search(self, query, num_results=10, qtype=‘’):) and do away with the without_count functions? Different scrapers could set their default value higher or lower. The final return could ensure that no more than the requested number of urls are returned with return urls[:num_results]

Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bhaveshAncommented, Jan 26, 2018

Make your own no need to delete

1reaction
cclausscommented, Jan 26, 2018

Three tests on a popular search term like “Fossasia” for each scraper:

  1. do not supply a num_results value and test that default value number of results are returned
  2. supply num_results=2 and then test that exactly 2 results are returned
  3. supply num_results=27 and then test that exactly 27 results are returned (or explain in the test why fewer that 27 will be returned).

Happy hunting!

Read more comments on GitHub >

github_iconTop Results From Across the Web

5.5 REST Operations: Search - HAPI FHIR
This operation should return all resources of a given type (this obviously doesn't make sense in all contexts, but does for some resource...
Read more >
Using the AND, OR, and NOT functions - Google Ads Editor Help
The AND(...) OR(...) and NOT(...) functions allow greater control in how multiple filter conditions are combined to target very specific items being searched...
Read more >
10 Writing Effective Functions - Invent with Python
When the introduction() function is called without a second argument, it uses the string 'Hello' by default. Note that parameters with default arguments...
Read more >
Should you always pass just the bare minimum data into a ...
Presumably, both functions require that user.getId(), user.getName(), and user.getPassword() be called, either inside the function (in the first ...
Read more >
Writing Functions | Practical Data Science
Here's what your custom function could look like. It takes a single input, the variable you want information about, and returns a data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found