I am writing a python program with py-stackexchange that takes a query and returns a list of urls to questions with that query in the title.
Here's the code:
#!c:/Python27/python.exe -u
import sys
sys.path.append('.')
import stackexchange
so = stackexchange.Site(stackexchange.StackOverflow)
def getLinkList(qry):
qs = so.search(intitle=qry)
retList = []
for q in qs:
retList.append(q.url)
return retList
The problem is, the qry string must appear verbatim in the title of the question, and I want it to return questions that are the closest to the qry string as possible (highest number of similar words), sort of like a search engine for questions.
Is there a way to do this?
/similar
method might suit your needs (api.stackoverflow.com/1.1/usage/methods/similar). You can access this in Py-StackExchange with thesite.similar()
method; just remember to update the library to a recent version.