I'm trying to find duplicates of this question:

What is the etymology of "word!"

Searching for word on ELU is fruitless, as this word is obviously used all the time on that site; I just want to find questions that have the word word in quotes. I tried searching for "'word'" and '"word"', but they both matched questions that didn't have the word in quotes.


Unfortunately this cannot be done effectively. Let me try to explain why.

Search is mostly about inverted indexes. We index a post by the words in that post. So, if the Post had the body:

Let's talk about searching for stuff

We'd index it at each of those words - known as terms.

We don't want you to have to type exactly the correct words to get good results, so we employ some normalization to breaking the documents down into terms. One thing we do is stem: searching becomes search so that a search for either term contains this result. This makes for a better experience.

Another thing that we do is tokenize (break the document into terms) by removing special characters and most punctuation. If we had:

This is an "exact" quoted sentence

We'd break it into this, is, an, exact, quote (notice the stemming), and sentence.

What you're proposing is leaving quotes in play, such that we'd break it into "exact". This could be done for a single word that is surrounded by quotes, but now think about what happens with this post:

This is an "exact quoted" sentence

We'd break it into this, is, an, "exact, quoted", sentence. Notice how "exact is a term and quoted" is a term. To find this document, you'd have to search for "exact - searching for exact would not contain this result. Also notice that we didn't stem quoted" so a search for both quoted and quote would not contain this result either. This would be very confusing behaviour.

Hopefully you can now see why we tokenize things by removing special characters such as quotes. It becomes really rigid and hard to find them otherwise.

Note that we support searching for an exact phrase by wrapping some or all of your search text with double quotes.

  • Could you do it like this: tokenize the words as you currently do, and use that to find all the posts containing word; this will make use of the inverted index. Then within those, perform an exact match including the punctuation.
    – Barmar
    Jan 19 '15 at 23:03
  • 2
    @Barmar = the "correct" way to do this is to tokenize the quoted phrase as a single element (and as individual words), then try and match on that giant element. This is bad for our index size, but not impossible. Just also not a priority at this time.
    – Haney StaffMod
    Jan 19 '15 at 23:05

You must log in to answer this question.

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