Hithighlighting boolean query including exact phrase words

Hi,

We are using ElasticSearch with version 2.4.

When we do search in a field for query as below in a field, it is not highlighting the complete phrase word.

(Google OR Bing) AND "SQL Developer"

The above query gives result properly, but if we use it with Hit-highlighting, it highlights not only Google and Bing, but it also consider the both SQL and Developer as separate words and highlight them separately instead of highlighting only exact phrase "SQL Developer" .

Below is the C# code, we are using for the same.

string keyword = @"(Google OR Bing) AND "SQL Developer"";
var filterQueries = new List<Func<QueryContainerDescriptor, QueryContainer>>();
filterQueries.Add(m2 =>
m2.QueryString(m3 => m3.Fields("Note").Query(Keyword)));

ISearchResponse result = client.Search(S => S.From(0)
.Size(20)
.MatchAll()
.Query(q => q
.Bool(b => b
.Filter(filterQueries)
))
.Highlight(h => h
.Fields(
fs => fs
.Field(p => p.Note)
.Type(HighlighterType.Plain)
.ForceSource()
.FragmentSize(fs1)
.NumberOfFragments(noF)
)
.PreTags("")
.PostTags("
")
)
);

Please help me if we are missing out any thing in query code.

Thanks
Hardik

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.