org.stanwood.media.search
Class SearchHelper

java.lang.Object
  extended by org.stanwood.media.search.SearchHelper

public class SearchHelper
extends java.lang.Object

This class provides some helper functions that can be used to do things like construct a normalised search query from a file name.


Constructor Summary
SearchHelper()
           
 
Method Summary
static java.lang.Integer extractPart(java.lang.StringBuilder term)
          Used to get a part number for the search term
static boolean hasIgnoredTokens(java.lang.StringBuilder term)
          Used to check if a search term has ignored tokens
static void removeIgnoredTokens(java.lang.StringBuilder term)
          Used to remove tokens that should be ignored from a search term
static void removeUnwantedCharacters(java.lang.StringBuilder term)
          This is used to remove any unwanted characters from search terms
static void replaceDots(java.lang.StringBuilder term)
          This is a helper method that will replace the dot's sometimes found in place of spaces of filenames.
static void replaceHyphens(java.lang.StringBuilder term)
          This is used to replace hyphens characters with spaces in the search term
static void replaceUnderscore(java.lang.StringBuilder term)
          This is used to replace underscore characters with spaces in the search term
static void replaceWithSpaces(java.lang.StringBuilder term)
          This is used to replace word seperator characters such as underscores with spaces.
static void trimRubishFromEnds(java.lang.StringBuilder term)
          Used to strip white space from either end of the search terms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchHelper

public SearchHelper()
Method Detail

replaceDots

public static void replaceDots(java.lang.StringBuilder term)
This is a helper method that will replace the dot's sometimes found in place of spaces of filenames.

Parameters:
term - The term that might contains dot's instead of spaces. This buffer will have the dot's replaced.

removeUnwantedCharacters

public static void removeUnwantedCharacters(java.lang.StringBuilder term)
This is used to remove any unwanted characters from search terms

Parameters:
term - The search term

replaceUnderscore

public static void replaceUnderscore(java.lang.StringBuilder term)
This is used to replace underscore characters with spaces in the search term

Parameters:
term - The search term

replaceHyphens

public static void replaceHyphens(java.lang.StringBuilder term)
This is used to replace hyphens characters with spaces in the search term

Parameters:
term - The search term

replaceWithSpaces

public static void replaceWithSpaces(java.lang.StringBuilder term)
This is used to replace word seperator characters such as underscores with spaces.

Parameters:
term - The search term

extractPart

public static java.lang.Integer extractPart(java.lang.StringBuilder term)
Used to get a part number for the search term

Parameters:
term - The search term
Returns:
The part number, or null if it could not be found

removeIgnoredTokens

public static void removeIgnoredTokens(java.lang.StringBuilder term)
Used to remove tokens that should be ignored from a search term

Parameters:
term - The search term

hasIgnoredTokens

public static boolean hasIgnoredTokens(java.lang.StringBuilder term)
Used to check if a search term has ignored tokens

Parameters:
term - The search term
Returns:
True if ignore tokens are found

trimRubishFromEnds

public static void trimRubishFromEnds(java.lang.StringBuilder term)
Used to strip white space from either end of the search terms

Parameters:
term - The search term