115

One of these is not like the others:

results of search


Well, it's not the only one; it was just "getting started"... My search for title:"getting started" is just lousy with similarly long summaries found later in the results:

<!-- There are too many long summaries... -->
<img src="https://i.sstatic.net/VIpfK.png">
<img src="https://i.sstatic.net/dctU5.png">
<img src="https://i.sstatic.net/5a9pR.png">
<img src="https://i.sstatic.net/QeitM.png">
<img src="https://i.sstatic.net/jvupv.png">
<img src="https://i.sstatic.net/kSaJX.png">

Why are some results so long? They're not summaries, it's actually the ENTIRE post being displayed!

Strangely enough, the same results may appear normally in other searches:


The comments have indicated that a number of other queries trigger the bug. I'm including some of them, and also adding some of my own, some of which are from other sites on the network:

Help me there's just too much that doesn't work! The list is very long, mostly grammatically correct, and shows too many extra characters in a large text block! The bug fix is too slow or the one big problem is too big! Why would they do this?


The longest one I can find is via this search. It's so big, I can't fit the entire "summary" in one image (because of the 2MB limit), so you can only see half here:

 <!-- Run at your own risk, really... -->
<img src="https://i.sstatic.net/myp9l.png">


I think I know what's triggering this, actually. It happens when you are searching for a phrase with the title: operator (which only returns questions, BTW) and the phrase also occurs in the body. All of the content after that trigger phrase will appear as the "summary", so of course there needs to be enough characters after the phrase appears for the bug to be visible.

(This was also reported here on the main meta.)

17
  • 24
    It's only getting started. Maybe an Elasticsearch issue with the highlighter?
    – CodeCaster
    Commented Jul 3, 2016 at 22:18
  • 3
    Could it be because of the abundance of angle-bracketed tags messing up with some regex-like mechanism? Commented Jul 4, 2016 at 0:30
  • 2
    @dorukayhan I considered the option, but it affects other posts without angle brackets. I have included more images (including Code Caster's).
    – Laurel
    Commented Jul 4, 2016 at 1:16
  • 1
  • 1
    All the examples I find consist of (at least) two words, each of which has at least 4 letters. Kind of weird. Commented Jul 4, 2016 at 3:03
  • 1
    Cannot reproduce. I only see the first 5/6 lines, not 20.
    – Bakuriu
    Commented Jul 4, 2016 at 11:53
  • 12
    I can reproduce with more search strings like; "Large text", "too long", "too big", the irony is complete :). I took the link from Steve Bennett as starting point.
    – Mixxiphoid
    Commented Jul 4, 2016 at 13:34
  • 1
    It also occurs for two three letter words: stackoverflow.com/search?q=+is%3Aq+title%3A%22one+two%22.
    – Benjamin
    Commented Jul 4, 2016 at 17:16
  • 1
    here's another good one: stackoverflow.com/… Commented Jul 5, 2016 at 6:56
  • 1
    one with a two-letter word: stackoverflow.com/search?q=+is%3Aq+title%3A%22find+me%22 Commented Jul 5, 2016 at 6:58
  • 8
    Maybe it's to make bad questions more noticeable. It's a feature!
    – Josiah
    Commented Jul 5, 2016 at 11:24
  • 10
    Inspired by @SteveBennett's search: stackoverflow.com/search?q=+is%3Aq+title%3A%22too+many%22 About halfway down the page you'll find what might be the most extreme example here.
    – Jim V
    Commented Jul 5, 2016 at 15:45
  • 3
    I was able to reproduce this, good catch. In my opinion there are many aspects of search that could benefit from improvement or at the very least oversight. There has been some progress in the past on looking into improving search but no real progress in making changes. I know that search isn't exactly at the core of Q&A, but having an improved search feature would greatly benefit the site.
    – Travis J
    Commented Jul 6, 2016 at 21:09
  • 5
    @TravisJ I agree, search isn't the core of Q & A, but it is still very important. It's supposed to help us thwart duplicates, but it's just a pain really. There needs to be some more priority to fixing it.
    – Laurel
    Commented Jul 6, 2016 at 21:21
  • 2
    @JoeFriend I am still able to reproduce this bug. See this search, for example.
    – Laurel
    Commented Jul 24, 2017 at 1:24

3 Answers 3

4

It was fixed yesterday when Nick Craver updated Search to Elastic 5.6.1: https://meta.stackexchange.com/a/301293/263422

1
  • Yeah, it seems to be fixed, thanks for telling me!
    – Laurel
    Commented Sep 26, 2017 at 3:34
11

As codecaster commented, this is a bug with the ElasticSearch highlighter. Elastic is returning more text than it should be, which is what we are seeing.

As such, it isn't something we can fix ourselves.

We are, however, in the process of updating Elastic to a more current version. Once the upgrade, there is a good chance the issue will be resolved.

2
3

Just looking at the various results, it seems like the root of the "problem" is the summary generator trying to include (highlight) all instances of the search terms in the search snippet (or at least as many as it can up to some internal count). It also has some word count limit, but for the most lengthy of summaries, it also seems to count code blocks as one "word", so the limit is still not "exceeded" no matter how long the block is.

It's almost certainly a feature to prevent breaking up <code> tags and the code they contain. Maybe to not break any syntax highlighters that might go over the summaries (not that they do normally, but they might at some point)?

The summaries that are abnormally long but without code tags or similar HTML blocks seem to be extra long because the search terms occur at the extremes of what the summary generator is willing to show, then it pads out the word count just a little more so the snippet doesn't cut off right at the search term but includes a bit more context after it.

Not sure what the solution to this all would be - the summary generator could try to break up long text with search terms on opposite ends of the potential summary (inserting at ... in the middle to indicate the break). Ignoring HTML tags altogether and allowing code blocks (etc.) to be cut off mid-block would solve the other problem, but break anyone who had built syntax highlighting or other features to run off the summaries that requires complete blocks...

5
  • 2
    Stack Overflow is not open source, so speculation about the source of this issue is hardly useful. I know I did the same in comments, but that's why it was a comment, not an answer.
    – CodeCaster
    Commented Jul 6, 2016 at 6:24
  • This is not correct. Some of the questions displaying the bug have no code AND the key phrase only occurs at the beginning of the post. The summary generator should be inserting the ellipsis already as it would when everything works right.
    – Laurel
    Commented Jul 6, 2016 at 21:03
  • @CodeCaster - I figures since the question was simply about "why are some results so long" finding the linking factor among all the bug examples would qualify as an explanation, albeit not a technical one. Commented Jul 7, 2016 at 19:00
  • @Laurel - The none code examples do still have large HTML blocks that would be interpreted by the summary generator as a single "word" Commented Jul 7, 2016 at 19:02
  • 2
    @BrianNorth As a site dedicated to programming, we have a lot of code, including markup languages like HTML. You're merely seeing circumstantial evidence; there are questions without code that exhibit the bug, like this one.
    – Laurel
    Commented Jul 7, 2016 at 19:05

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