1

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?

rene
  • 2,527
  • 2
  • 16
  • 35
kjakeb
  • 113
  • 3
  • You might find, now that version 1.1 of the API has been released, that the /similar method might suit your needs (http://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

1 Answers1

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.

systempuntoout
  • 7,985
  • 4
  • 20
  • 27