Class AiSearchWebScript
- All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
AI-oriented entity search (/becpg/remote/ai/search).
Reuses the standard search dispatch (AbstractEntityWebScript.findEntities(org.springframework.extensions.webscripts.WebScriptRequest, java.lang.Integer, boolean)) — simple full-text search via ?query=,
or an advanced criteria search via a POST JSON body — but returns a compact result
(nodeRef, type, name, code) instead of full entity serialization, to keep
AI token usage low. Search runs as the authenticated user, so tenant and permission filtering are inherited.
Optional fields projection — performance-conscious by design. When ?fields=ns:p1,ns:p2
is supplied, each hit also carries those properties under a fields object. To keep the cost bounded
and predictable we read the node's property map once (NodeService.getProperties(org.alfresco.service.cmr.repository.NodeRef))
and return the requested plain property values as-is: we deliberately do not resolve
associations, characteristic names or datalists here (that is the expensive part of full serialization).
The number of projected fields is capped (MAX_PROJECTION_FIELDS) and results are bounded by
maxResults. For richer (assoc-resolved) data the caller fetches the single entity on demand.
- Author:
- matthieu
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intHard cap on the number of projected fields, to keep the per-hit cost bounded.Fields inherited from class fr.becpg.repo.web.scripts.remote.AbstractEntityWebScript
advSearchService, JSON_PARAM, logger, mimetypeService, namespaceService, nodeService, PARAM_ALL_VERSION, PARAM_EXCLUDE_SYSTEMS, PARAM_FIELDS, PARAM_FORMAT, PARAM_LISTS, PARAM_MAX_RESULTS, PARAM_NODEREF, PARAM_PAGE, PARAM_PARAMS, PARAM_PATH, PARAM_QUERY, PARAM_TYPE, permissionService, remoteEntityService, remoteRateLimiter, securityService, systemConfigurationService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecuteInternal(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) executeInternal.private Set<org.alfresco.service.namespace.QName> parseFields(String fieldsParam) Parses a comma-separatedfieldsparameter into a bounded set of property QNames.Methods inherited from class fr.becpg.repo.web.scripts.remote.AbstractEntityWebScript
booleanParam, decodeParam, execute, extractFields, extractJsonParamName, extractLists, extractParams, findEntities, findEntity, getContentType, getFormat, intParam, intParam, isBrokenPipe, maxResultsLimit, sendOKStatus, setAdvSearchService, setMimetypeService, setNamespaceService, setNodeService, setPermissionService, setRemoteEntityService, setRemoteRateLimiter, setSecurityService, setSystemConfigurationServiceMethods inherited from class org.springframework.extensions.webscripts.AbstractWebScript
addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
-
Field Details
-
DEFAULT_MAX_RESULTS
private static final int DEFAULT_MAX_RESULTS- See Also:
-
MAX_PROJECTION_FIELDS
private static final int MAX_PROJECTION_FIELDSHard cap on the number of projected fields, to keep the per-hit cost bounded.- See Also:
-
-
Constructor Details
-
AiSearchWebScript
public AiSearchWebScript()
-
-
Method Details
-
executeInternal
protected void executeInternal(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) throws IOException executeInternal.
- Specified by:
executeInternalin classAbstractEntityWebScript- Parameters:
req- aWebScriptRequestobjectresp- aWebScriptResponseobject- Throws:
IOException- if any.
-
parseFields
Parses a comma-separatedfieldsparameter into a bounded set of property QNames. Unknown prefixes / malformed tokens are skipped (best-effort), and the set is capped to keep the cost bounded.
-