1

Hello,

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? Thanks in advance!

  • You might find, now that version 1.1 of the API has been released, that the /similar method might suit your needs (api.stackoverflow.com/1.1/usage/methods/similar). You can access this in Py-StackExchange with the site.similar() method; just remember to update the library to a recent version. – Lucas Jones Feb 14 '11 at 17:33
2

No, you can't do it because py-stackexchange is a library based on SE API that does not provide that kind of search.
You should use Google API search instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .