Skip to content

Instantly share code, notes, and snippets.

@mrvisser
Created July 10, 2012 16:20
Show Gist options
  • Save mrvisser/3084440 to your computer and use it in GitHub Desktop.
Save mrvisser/3084440 to your computer and use it in GitHub Desktop.
New solr search "parameters" handling whiteboard
// DomainObjectQueryHandler will assert a generic "SearchInfo" data-type
public abstract class DomainObjectQueryHandler<T extends SearchInfo> {
...
public abstract T buildSearchInfo(HttpServletRequest request);
...
public String refineQString(T searchInfo) {
return null;
}
}
"T" would be asserted on the implementation of DomainObjectQueryHandler object:
public class LibraryContentQueryHandler extends DomainObjectQueryHandler<LibrarySearchInfo> {
...
// the query handler will be responsible for building / producing the object based on the request
// TODO: may need to to also input default "template options"
public LibrarySearchInfo buildSearchInfo(HttpServletRequest request) {
LibrarySearchInfo info = new LibrarySearchInfo();
info.setUserId(request.getParameter(...));
...
}
// the search info data-type would then feed into the query string generation
public String refineQString(LibrarySearchInfo searchInfo) {
return "userid:"+SearchUtil.escapeQueryChars(searchInfo.getUserId());
}
// the notion of "loadUserProperties" would no longer exist and be replaced with buildSearchInfo(...)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment