org.hd.d.pg2k.webSvr.util
Class SearchUtils

java.lang.Object
  extended by org.hd.d.pg2k.webSvr.util.SearchUtils

public final class SearchUtils
extends java.lang.Object

Search related utility functions. This is for algorithms only of interest to Web apps, often JSPs.

One advantage of having a method here rather than in-line in a JSP is that is is pre-compiled off-line for speed and robustness.


Constructor Summary
private SearchUtils()
          Prevent construction of an instance.
 
Method Summary
static java.util.List<Name.ExhibitFull> doRelatedExhibitsSearch(Name searchTerm, DataSourceBean dataSource, int maxResults, ORG.hd.d.jIndexer.server.JIndexBean.SearchFilterByName filter, boolean fallback, boolean alreadyCanon)
          Compute immutable full exhibit names of "similar" items, eg in the foot of each catalogue page; never null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchUtils

private SearchUtils()
Prevent construction of an instance.

Method Detail

doRelatedExhibitsSearch

public static java.util.List<Name.ExhibitFull> doRelatedExhibitsSearch(Name searchTerm,
                                                                       DataSourceBean dataSource,
                                                                       int maxResults,
                                                                       ORG.hd.d.jIndexer.server.JIndexBean.SearchFilterByName filter,
                                                                       boolean fallback,
                                                                       boolean alreadyCanon)
                                                                throws java.io.IOException
Compute immutable full exhibit names of "similar" items, eg in the foot of each catalogue page; never null. The search term is assumed to be some leading part of the (short) exhibit name, ie excluding the directory components.

This may try a narrow search, insisting that the first search word must appear in candidate result exhibit names and that preferably most search terms should be matched, optionally falling back to a wider search if the narrow one fails.

This does not cache its results.

When this returns an empty value it always returns the same instance.

Parameters:
searchTerm - non-null, non-empty search term(s); earlier words are possibly more significant
dataSource - data source; never null
maxResults - maximum number of results; never null
filter - non-null filter of acceptable exhibits
fallback - if true and a narrow search fails to generate answers, fall back to a wider search
alreadyCanon - if true then the searchTerm is already canonicalised
Returns:
in-order list of matches as full exhibit names, best first, up to requested maximum number of results; may be zero-length but never null
Throws:
java.io.IOException - in case of error

DHD Multimedia Gallery V1.60.69

Copyright (c) 1996-2012, Damon Hart-Davis. All rights reserved.