Free Support Forum - groupdocs.com

Restrict additional fields in the search results using text search API for .NET

foreach (var item in getAllDocuments)
{
index.Events.FileIndexing += (sender, args) =>
{
if (args.DocumentFullPath.EndsWith(item.Location))
{
args.AdditionalFields = new DocumentField[] // Setting additional fields for the current document
{
new DocumentField(“ProjectName”, item.ProjectName),
new DocumentField(“DataRoomName”, item.DataRoomName),
new DocumentField(“FolderName”, item.FolderName),
new DocumentField(“UserName”, model.DisplayUserName)
};
}
};
}

while creating an index i’m adding the additional fields.those additional fields should not come as search result.how to restrict that.

@bharathiGK

We are investigating this scenario. Your investigation ticket ID is SEARCHNET-2286. As there’s any update, you’ll be notified.

@bharathiGK

We have an update on SEARCHNET-2286. Yes, you can prevent search results. For example, like this:
query = “Einstain AND NOT (additional_field_name: Einstain)”.
Secondly, You can add attributes instead of additional fields. Attributes do not appear in the search results and you can filter search results by them. Please download API version 20.8.