You have to create a custom index field and add custom logic to retrieve categories.
The code which you can use for it:
var allCategories = await this.Commander.Pipeline<IGetCategoriesPipeline>().Run(new GetCategoriesArgument(" "), context);
var parentCategories = allCategories.Where(category =>
The AND or OR operators in between the parts of your query are placed based on the Operation as set in the SearchStringModel.
In your case, the Operation is set to "must" - which is an AND. If you want an OR, you can use "should" here:
protected virtual SearchStringModel BuildModel(string fieldName, string value)
var name = fieldName;