19

While answering this question earlier, I looked for previous answers mentioning one of the methods to use, which I know to be setEndpointIdentificationAlgorithm. I remember writing a few answers about this, so I know they are there.

Yet, a direct search for "setEndpointIdentificationAlgorithm" in the top right box only yields two results:

A Google search for "site:stackoverflow.com setEndpointIdentificationAlgorithm" shows there are indeed more results, for example:

Shouldn't these be found using the Stack Overflow search box?

5
  • 11
    Hang on... you actually use the search box in the top corner?! Kudos to you!
    – Tanner
    Sep 3, 2014 at 12:57
  • 2
    @Tanner so do I and I love it
    – user2140173
    Sep 3, 2014 at 14:06
  • 1
    @mehow most of the time I just find it easier using google as opposed to learning all of the intricacies of that search box. It's crying out for an advanced search control that simplifies the kind of searches that are detailed on that page.
    – Tanner
    Sep 3, 2014 at 14:12
  • 1
    @Tanner yes it would be nice but since this is a site aimed at programmers I quite enjoy the way it's designed to challenge us ;)
    – user2140173
    Sep 3, 2014 at 14:15
  • 3
    @mehow look what you made me do: meta.stackoverflow.com/questions/270548/…
    – Tanner
    Sep 3, 2014 at 15:44

1 Answer 1

22

Text in codeblocks is not split like regular text when indexed; the surrounding syntax is not stripped when indexing. Specifically, the preceding identifier and dot are included in the indexed term. Because of that, your sample posts do not contain just setEndpointIdentificationAlgorithm; they contain the term sslParams.setEndpointIdentificationAlgorithm instead.

Your two hits contain the keyword outside of code blocks and are split according to text rules (so split on different word boundaries), so these are found.

Search with a wildcard instead:

https://stackoverflow.com/search?q=*setEndpointIdentificationAlgorithm

That search finds 10 results.

Those 8 extra results all have a full stop before the identifier; searching for *.setEndpointIdentificationAlgorithm instead gives you just those 8 results for example.

Code is treated differently from text because there syntax like dots matter; my guess is that the elastic search indexer uses some general rules of thumb that should work across the broadest possible spectrum of languages. Dots are not seen as word delimiters, but parentheses are.

Strangely enough, code is stemmed; you can search for SSLParameter (singular) and find posts where only SSLParameters (plural) is used in a code block.

2
  • 11
    Sure, but in most languages, dots and brackets are reasonable separators for keywords one way or another. Don't you think it would make sense to be able to search this way too?
    – Bruno
    Sep 3, 2014 at 13:11
  • 1
    @Bruno: It would make total sense; I merely tried to document the behaviour here and how you can work around it. :-)
    – Martijn Pieters Mod
    Sep 3, 2014 at 13:55

You must log in to answer this question.

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