@Operation(name = JpaConstants.OPERATION_SUGGEST_KEYWORDS, idempotent = true) public Parameters suggestKeywords( @OperationParam(name = "context", min = 1, max = 1) String theContext, @OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam, @OperationParam(name = "text", min = 1, max = 1) String theText ) { JpaSystemProviderDstu3.validateFulltextSearchEnabled(mySearchDao); if (isBlank(theContext)) { throw new InvalidRequestException("Parameter 'context' must be provided"); } if (isBlank(theSearchParam)) { throw new InvalidRequestException("Parameter 'searchParam' must be provided"); } if (isBlank(theText)) { throw new InvalidRequestException("Parameter 'text' must be provided"); } List<Suggestion> keywords = mySearchDao.suggestKeywords(theContext, theSearchParam, theText); Parameters retVal = new Parameters(); for (Suggestion next : keywords) { retVal.addParameter() .addPart(new Parameter().setName("keyword").setValue(new StringDt(next.getTerm()))) .addPart(new Parameter().setName("score").setValue(new DecimalDt(next.getScore()))); } return retVal; }
/** * Gets the first repetition for <b>part</b> (), * creating it if it does not already exist. * * <p> * <b>Definition:</b> * A named part of a parameter. In many implementation context, a set of named parts is known as a \"Tuple\" * </p> */ public Parameter getPartFirstRep() { if (getPart().isEmpty()) { return addPart(); } return getPart().get(0); }
@Operation(name = JpaConstants.OPERATION_SUGGEST_KEYWORDS, idempotent = true) public Parameters suggestKeywords( @OperationParam(name = "context", min = 1, max = 1) String theContext, @OperationParam(name = "searchParam", min = 1, max = 1) String theSearchParam, @OperationParam(name = "text", min = 1, max = 1) String theText ) { JpaSystemProviderDstu3.validateFulltextSearchEnabled(mySearchDao); if (isBlank(theContext)) { throw new InvalidRequestException("Parameter 'context' must be provided"); } if (isBlank(theSearchParam)) { throw new InvalidRequestException("Parameter 'searchParam' must be provided"); } if (isBlank(theText)) { throw new InvalidRequestException("Parameter 'text' must be provided"); } List<Suggestion> keywords = mySearchDao.suggestKeywords(theContext, theSearchParam, theText); Parameters retVal = new Parameters(); for (Suggestion next : keywords) { retVal.addParameter() .addPart(new Parameter().setName("keyword").setValue(new StringDt(next.getTerm()))) .addPart(new Parameter().setName("score").setValue(new DecimalDt(next.getScore()))); } return retVal; }