{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/2157","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/2157/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/2157/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/2157/events","html_url":"https://github.com/elastic/elasticsearch/issues/2157","id":6128596,"number":2157,"title":"No highlighting for phrases with stop words when term vector with positions offsets is enabled","user":{"login":"imotov","id":655851,"avatar_url":"https://avatars.githubusercontent.com/u/655851?v=3","gravatar_id":"","url":"https://api.github.com/users/imotov","html_url":"https://github.com/imotov","followers_url":"https://api.github.com/users/imotov/followers","following_url":"https://api.github.com/users/imotov/following{/other_user}","gists_url":"https://api.github.com/users/imotov/gists{/gist_id}","starred_url":"https://api.github.com/users/imotov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imotov/subscriptions","organizations_url":"https://api.github.com/users/imotov/orgs","repos_url":"https://api.github.com/users/imotov/repos","events_url":"https://api.github.com/users/imotov/events{/privacy}","received_events_url":"https://api.github.com/users/imotov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Highlighting","name":":Highlighting","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2012-08-09T14:50:30Z","updated_at":"2015-09-14T06:25:09Z","closed_at":null,"body":"If a record contains a phrase with stop words in the middle  (`foo and bar`, for example) and the search expression contains a matching phrase, highlighter produces different results that depend on how the field was indexed. \n\n* If the field was indexed with `\"term_vector\": \"with_positions_offsets\"` elasticsearch doesn't highlight anything\n* if the field was indexed with `\"term_vector\": \"with_positions_offsets\"` and the field's analyzer has `\"enable_position_increments\": false`, elasticsearch highlights the entire phrase: `foo and bar`. \n* if the field was indexed without \"term_vector\" enabled elasticsearch highlights words `foo` and `bar` separately.\n\nFull repro can be found here: https://gist.github.com/3280061\n\nSolr seems to be behaving the same way: see https://gist.github.com/3279879#file_response_fvh.txt  and [SOLR-3724](https://issues.apache.org/jira/browse/SOLR-3724)\n\nA possible workaround for us would be to add a flag on the highlighter query and globally that would disable fast vector highlighter. FVH is relatively new portion of lucene and this is already the second time when I wish I had a way to temporarily disable it without reindexing my data. (The first time was [LUCENE-3719](https://issues.apache.org/jira/browse/LUCENE-3719).) I could submit a pull request if you think that would be a useful feature."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/139973618","html_url":"https://github.com/elastic/elasticsearch/issues/2157#issuecomment-139973618","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/2157","id":139973618,"user":{"login":"aih","id":217356,"avatar_url":"https://avatars.githubusercontent.com/u/217356?v=3","gravatar_id":"","url":"https://api.github.com/users/aih","html_url":"https://github.com/aih","followers_url":"https://api.github.com/users/aih/followers","following_url":"https://api.github.com/users/aih/following{/other_user}","gists_url":"https://api.github.com/users/aih/gists{/gist_id}","starred_url":"https://api.github.com/users/aih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aih/subscriptions","organizations_url":"https://api.github.com/users/aih/orgs","repos_url":"https://api.github.com/users/aih/repos","events_url":"https://api.github.com/users/aih/events{/privacy}","received_events_url":"https://api.github.com/users/aih/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T06:25:09Z","updated_at":"2015-09-14T06:25:09Z","body":"Thank you, @nik9000! I tried the experimental highlighter and it had the same behavior as fvh (ignoring stopwords in phrase searches, and therefore missing matches where the stopword is in the middle-- e.g. \"motion to adjourn\"). I also noticed that the experimental highlighter doesn't support whole-field fragments (number_of_fragments = 0).\r\n**However**, your comment solved my problem. Indeed, it looks like the Wikipedia search matches phrases because it uses a whitespace-like analyzer. So, I took out the stopwords from my English analyzer, reindexed, and now I've got phrase highlighting with stopwords. Would still be nice to have the option to match stopwords with the highlighter only, but this works for now."}}