Class SearchMatchService
java.lang.Object
io.meeds.social.search.service.SearchMatchService
Collects the answers of the
SearchMatchPlugin contributors of one
unified-search content type and merges them, once, for every host: a host
calls collect(String, SearchMatchRequest, List) and writes the ids
it returns into its own query, beside its permission filters; it keeps no
merge logic of its own.- Since:
- 8.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe grammar a contributed id must match to reach a host's query: letters, digits and dashes, 64 characters at most.static final intThe number of contributed ids a search keeps, all contributors merged. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.meeds.social.search.model.SearchMatchescollect(String contentType, io.meeds.social.search.model.SearchMatchRequest request, List<io.meeds.social.search.plugin.SearchMatchPlugin> legacyContributors) Asks every contributor of a content type once for the objects matching a keyword, and merges their answers.
-
Field Details
-
CONTRIBUTED_ID_PATTERN
The grammar a contributed id must match to reach a host's query: letters, digits and dashes, 64 characters at most. Any other id is dropped.- See Also:
-
MAX_CONTRIBUTED
public static final int MAX_CONTRIBUTEDThe number of contributed ids a search keeps, all contributors merged.- See Also:
-
-
Constructor Details
-
SearchMatchService
public SearchMatchService()
-
-
Method Details
-
collect
public io.meeds.social.search.model.SearchMatches collect(String contentType, io.meeds.social.search.model.SearchMatchRequest request, List<io.meeds.social.search.plugin.SearchMatchPlugin> legacyContributors) Asks every contributor of a content type once for the objects matching a keyword, and merges their answers.The contributors are looked up by type at each call, kept when their
SearchMatchPlugin.getContentType()is the given content type, and called in the order of their implementation's fully qualified class name, whatever the order the container registered them in (the Kernel-Spring bridge keeps no Spring bean name in the container, it registers each bean under its class); the given legacy contributors are called next, in the order given. Each object id is kept once, at most 1000 in all, with the match line of the first contributor that gave it, or none when that contributor gave none (as the task and file searches merged their contributors); an id outside "[A-Za-z0-9-]{1,64}" is dropped. A contributor that throws is logged and skipped.- Parameters:
contentType- the host's unified-search content typerequest- what the contributors are askedlegacyContributors- the host's deprecated contributors, each wrapped as aSearchMatchPlugin, or an empty list- Returns:
- the merged answer,
SearchMatches.EMPTYwhen no contributor found anything, never null
-