info.aduna.text
Class StringSearch
java.lang.Object
info.aduna.text.StringSearch
public class StringSearch
- extends java.lang.Object
Method Summary |
static boolean |
contains(java.lang.String text,
java.lang.String token)
Does the text contain the specified token? |
static int |
find(java.lang.String text,
java.lang.String searchString,
boolean caseSensitive)
Find keywords specified by an 'AltaVista'-like search string. |
static int |
find(java.lang.String text,
java.lang.String searchString,
boolean caseSensitive,
boolean relevance)
Find keywords specified by an 'AltaVista'-like search string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringSearch
public StringSearch()
find
public static int find(java.lang.String text,
java.lang.String searchString,
boolean caseSensitive)
- Find keywords specified by an 'AltaVista'-like search string. Eg: "san
francisco" +"golden gate" -alcatr* NOTE: '+' in user input must be
replaced by '%2B' in search string ' ' in user input must be replaced by
'%20' in search string
- Parameters:
text
- the text to search insearchString
- an 'AltaVista'-like search stringcaseSensitive
- is the search case-sensistive?
- Returns:
- an integer indicating the relevance of the text, where -1
indicates a violation of the search query where 0 indicates
irrelevance where N indicates the relevance of the search
find
public static int find(java.lang.String text,
java.lang.String searchString,
boolean caseSensitive,
boolean relevance)
- Find keywords specified by an 'AltaVista'-like search string. This method
allows you to do a slightly more efficient search at the cost of getting
only 1 when the text matches the query or -1 when it does not.
- Parameters:
text
- the text to search insearchString
- an 'AltaVista'-like search stringcaseSensitive
- is the search case-sensistive?relevance
- should we report relevance count or simply 'match' (1) or 'no
match' (-1)?
- Returns:
- an integer indicating the relevance of the text, where -1
indicates a violation of the search query (no match). where 0
indicates irrelevance (when relevance is true). where N indicates
the relevance of the search, or 1 indicates the searchString
matched (when relevance is false).
contains
public static boolean contains(java.lang.String text,
java.lang.String token)
- Does the text contain the specified token?
- Parameters:
text
- the text to searchtoken
- the token to look for
- Returns:
- true if the text contains the specified token, false otherwise.
Copyright © 2010 Aduna. All Rights Reserved.