chandrakanth s
chandrakanth s

Reputation: 1

Disabling a specific search restriction

When full indexing is ran, searchRestrictions are getting applied and facet creation is failing. When I use SessionService.executeInLocalView() all the searchRestrictions are disabled.

But my requirement is that I need to disable a particular restriction (not all restrictions) for full indexing context (not to disable/change at DB level). Is there any OOTB method that I can use to achieve this if not what is the best way to achieve this.

Upvotes: 0

Views: 341

Answers (1)

Yoni
Yoni

Reputation: 1430

You can search the restriction through

searchRestrictionService.getSessionSearchRestrictions();

and loop over that list to find the one you need. (Or create a new method to fetch a specific search restriction)

Next you can remove that restriction from the session:

searchRestrictionService.removeSessionSearchRestrictions(restrictionsToRemove);

To have this only affect for the SessionService.executeInLocalView()

Upvotes: 0

Related Questions