I have a search field where the user can enter words to search for in a bunch of fields. I use a MultiMatchQuery and it works nicely.
But, there as an access issue to it. Besides from the search I do today, I would like to check if a string exists within a field too.
So, user John has access 345 and searches for "apple". Then I want him to get hit on every document with the word "apple" (as it functions today) but only if "345" is within an access-field for each document.
How do I construct this?
Today I have:
Query = new MultiMatchQuery
{
Query = searchString,
Fields = new Field("discussion.comment.title", weightTitle).And("discussion.comment.descp", weightDescp).And("discussion.createdbypersonalias", weightAuthor)
.And("discussionAttachment.filecontent", WeightAttachment),
Type = TextQueryType.CrossFields,
},