// Finally, figure out if this entity query needs to be read-restricted, we have indexed the readAccessLevel of it
if (searchableEntity.getHandler().isReadAccessChecked()) {
Integer currentAccessLevel = (Integer)Component.getInstance("currentAccessLevel");
StringBridge paddingBridge = new PaddedIntegerBridge();
Query accessLimitQuery =
new ConstantScoreRangeQuery(FIELD_READACCESSLVL, null, paddingBridge.objectToString(currentAccessLevel), true, true);
Filter accessFilter = new QueryWrapperFilter(accessLimitQuery);
FilteredQuery accessFilterQuery = new FilteredQuery(entityQuery, accessFilter);
log.debug("adding filtered entity query to main query: " + accessFilterQuery);
mainQuery.add(accessFilterQuery, BooleanClause.Occur.SHOULD);