In your map function, collect the words into a set data structure to eliminate duplicates, before emitting them. (Do the same thing when querying, in case the query has duplicate words. In fact, the whole function that takes a string and returns a set of words should be shared between the map function and the query code.)
I used to have an O'Reilly book (circa 2008) that explained the basics of various search techniques like web-crawling and full-text indexing, with examples in Python. I can't remember the title, though.
—Jens