If you were implementing a fully custom suggestion provider, applying customizations at this level would work as expected. However, under the covers, SearchRecentSuggestionsProvider queries its local table with the following hard-coded arguments (have a look):
- selection = "display1 LIKE ?"
- selectionArgs = ["%{query}%"]
where {query} is the search query (it is sandwiched between two percent signs so that any character match anywhere in the string counts). It ignores the value passed in for the selection string (which is what you are setting with the searchSuggestSelection
parameter) and the args array (beyond checking if it is empty), so there really isn't much you can do from XML.
Because the implementation ignores incoming parameters, there is no easy fix or override. To save yourself duplicate coding, I would:
- Copy the entire implementation of
SearchRecentSuggestionsProvider
from the link above. Nothing the class does should be framework private, so a direct copy should compile.
- Modify the construction statement from the args array, inside the
query()
method, to be String like = selectionArgs[0] + "%"
instead of String like = "%" + selectionArgs[0] + "%"
(i.e. remove the first percent)
- Subclass
ProductSearchSuggestionProvider
from your new implementation instead.