does filetype equals pdf in google cse list work in python - python-3.x

I am using google custom search through the api google_api_client python. I want to retrieve the pdf documents for a particular query. Below is the function that does it.
def query_results(service,q=None,startIndex=1,siteSearch=None,fileType=None):
return service.cse().list(
q=q,
cx='000906600611484344115:o9lfdh9y1m5',
start=startIndex,
siteSearch=siteSearch,
fileType=fileType,
safe='off'
).execute()
When i call the above method passing q="alienware", filetype="pdf" and siteSearch="google.com", I get hardly one result. But then when I type the same query filetype:pdf alienware in google search through browser, I got plenty of results. Did I do any wrong ? or Is there an issue with the api itself ?.
When i say I got plenty of results, I mean the below image
Below is the configuration of custom search

Specifying siteSearch="google.com" means you will only search pages on google.com. It is equivalent to searching for site:google.com on Google. Remove the siteSearch and you should get the expected results.

Related

wikipedia api search titles generator

Trying to search tiles through the api using a generator.
I notice that there are two possible generators, with both I have problems:
prefix search - doesn't work well if I have multiple words and the order is reversed in the query (for example "brian adams" would return an answer, however "adams brian" does not
search - seems to not allow searching by titles, only by text which returns low-quality results.
Anyone knows of a way around this?
"srwhat=title" is disabled, so you should use "intitle:" in your search query:
https://en.wikipedia.org/w/api.php?action=query&list=search&srnamespace=0&srprop=timestamp&&srsearch=intitle:adams%20brian
for more info please check this page:
https://www.mediawiki.org/wiki/API:Search

How to get the file excerpts for search using box api?

http://developers.box.com/docs/#search
This api returns only the files/folders related to the search query. How do I show the search excerpts?
Should I integrate solr/lucene for search?
EDIT:
I mean excerpt from the content of the files/documents. The search snippets that you see like in google.
Example:
http://www.bestrank.com/files/uploads/39/image/anatomy-of-a-search-engine-snippet.png
The description in this case.
The Box API currently does not provide this in the search response, but we're looking at adding it sometime in the future.

Search keyword from google to my site

If user search a particular keyword in google and google returns set of results with url. Now if user comes to my website after clicking any result, then how can I know that search keyword.
In bing and yahoo I am able to get this using "q" and "p" respectively. Like "http://www.bing.com/search?q=......" and "http://in.search.yahoo.com/search......?p=......&.....".
But in google I am unable to find any parameters to get search keyword. I am using php.
Please help.
EDIT:
It is not possible to get the search string once you click on a search result.
if I search for stackoverflow.. this is what I get.. link not showing up properly in a comment..
so adding an answer.. you should be able to "?q=" as well for google
https://www.google.com/search?q=stackoverflow&rlz=1C1CHFX_enUS524US524&oq=sta&aqs=chrome.3.69i60l3j69i59j69i57j69i65.2857j0&sourceid=chrome&ie=UTF-8

How to place search query in the URL?

With a lot of search engines, you can find the string you are searching in the URL.
However, http://drugcompare.destinationrx.com/Home.aspx does not let me do this. When I search something, the resulting URL is http://drugcompare.destinationrx.com/DrugCompare.aspx no matter what.
Is there any way I can find out whether I can search the website by adding something to the end of the URL, like "?query=searchstring" instead of using the form provided on the page? Basically I need a unique URL.
that website you pointed at uses POST to send data for its search query which means you wont be able to see or append it on the URL bar. The reason for that is either for security or the search query it generates is a complex object or too long and does not fit in a url. websites such as search engines uses GET, with that you can append your search query in the url by following the syntax it generates.

foursquare website venue search not matching up to api search

The answer just might be alluding me, but this bugs me
I've been doing a simple search trying to find all the outdoor picnic spots near me. So I search for picnic in my zip code, and I get a list of results.
https://foursquare.com/search?tab=tipResults&q=picnic&lat=&lng=&near=10001
I then try to do the same search using the api (the venues/explore endpoint) to see if my app works well, and I get a completely different list of places. The api url that I've been using is
https://api.foursquare.com/v2/venues/explore?near=10001&section=outdoors&query=picnic&radius=5000&client_id=XXXX&client_secret=YYYY
BTW, If I dont include a radius, it only returns 1 entry.
The web address you provided: https://foursquare.com/search?tab=tipResults&q=picnic&lat=&lng=&near=10001
Is tip results around 10001.
The API call you provided: https://api.foursquare.com/v2/venues/explore?near=10001&section=outdoors&query=picnic&radius=5000&client_id=XXXX&client_secret=YYYY
Is a single explore search api call.
These two are very different, and will yield different results
Try running a tip search via the API as such (API docs at this place):
https://api.foursquare.com/v2/tips/search?near=10001&query=picnic
(direct link for testing it)
Let us know if this this clears it up.

Resources