private ErrorMessage validate(Query query) { String attribute = query.getRanking().getMatchPhase().getAttribute(); if ( attribute != null && ! validMatchPhaseAttributes.contains(attribute) ) { return ErrorMessage.createInvalidQueryParameter("The attribute '" + attribute + "' is not available for match-phase. " + "It must be a single value numeric attribute with fast-search."); } attribute = query.getRanking().getMatchPhase().getDiversity().getAttribute(); if (attribute != null && ! validDiversityAttributes.contains(attribute)) { return ErrorMessage.createInvalidQueryParameter("The attribute '" + attribute + "' is not available for match-phase diversification. " + "It must be a single value numeric or string attribute."); } return null; }
private void setDegradation(Query query) { query.trace("Using sorting degrading for performance - totalHits will be wrong. " + "Turn off with sorting.degrading=false.", 2); Sorting.FieldOrder primarySort = query.getRanking().getSorting().fieldOrders().get(0); // ensured above MatchPhase matchPhase = query.getRanking().getMatchPhase(); matchPhase.setAttribute(primarySort.getFieldName()); matchPhase.setAscending(primarySort.getSortOrder() == Sorting.Order.ASCENDING); if (matchPhase.getMaxHits() == null) matchPhase.setMaxHits(decideDefaultMaxHits(query)); }
MatchPhase matchPhase = ranking.getMatchPhase(); if (key.last().equals(MatchPhase.ATTRIBUTE)) return matchPhase.getAttribute(); if (key.last().equals(MatchPhase.ASCENDING)) return matchPhase.getAscending(); if (key.last().equals(MatchPhase.MAX_FILTER_COVERAGE)) return matchPhase.getMaxFilterCoverage(); } else if (key.size() >= 4 && key.get(2).equals(Ranking.DIVERSITY)) { Diversity diversity = ranking.getMatchPhase().getDiversity(); if (key.size() == 4) { if (key.last().equals(Diversity.ATTRIBUTE)) return diversity.getAttribute();
MatchPhase matchPhase = ranking.getMatchPhase(); if (key.last().equals(MatchPhase.ATTRIBUTE)) { matchPhase.setAttribute(asString(value, null)); Diversity diversity = ranking.getMatchPhase().getDiversity(); if (key.last().equals(Diversity.ATTRIBUTE)) { diversity.setAttribute(asString(value, null));