pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util.search
Class SearchSuggestion

java.lang.Object
  extended by org.torweg.pulse.util.search.SearchSuggestion
All Implemented Interfaces:
java.io.Serializable

@Entity
public class SearchSuggestion
extends java.lang.Object
implements java.io.Serializable

a suggestion for the AJAX based search.

Version:
$Revision: 1510 $
Author:
Thomas Weber
See Also:
Serialized Form

Constructor Summary
protected SearchSuggestion()
          Deprecated. 
  SearchSuggestion(java.util.Locale loc, java.lang.String query, long hits)
          creates a new SearchSuggestion for the given locale, query and number of hits.
 
Method Summary
 void addRecurrence(long h, long i)
          adds another recurrence of the search being the base of the suggestion with the given number of results.
 java.lang.String getId()
           
 double getImportance()
          returns the importance of the suggestion for ordering, a value between 0 and 1.
 long getLastRecurrence()
          returns the timestamp of the last recurrence of the search being the base of the suggestion.
 java.util.Locale getLocale()
          returns the locale of the suggestion.
 long getRecurrences()
          returns the number of recurrences of the search being the base of the suggestion.
 java.lang.String getSearchQuery()
          returns the search query of the search being the base of the suggestion.
static java.lang.String shortenSearch(java.lang.String search)
          shortens the given search string to be 80 characters or shorter, if possible at a space character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchSuggestion

@Deprecated
protected SearchSuggestion()
Deprecated. 

used by HibernateTM.


SearchSuggestion

public SearchSuggestion(java.util.Locale loc,
                        java.lang.String query,
                        long hits)
creates a new SearchSuggestion for the given locale, query and number of hits.

Parameters:
loc - the locale of the search
query - the search query (limited to 80 characters)
hits - the number of matching results
Method Detail

getId

public final java.lang.String getId()
Returns:
Returns the id.

getLocale

public final java.util.Locale getLocale()
returns the locale of the suggestion.

Returns:
the locale

getLastRecurrence

public final long getLastRecurrence()
returns the timestamp of the last recurrence of the search being the base of the suggestion.

Returns:
the timestamp of the last recurrence

getRecurrences

public final long getRecurrences()
returns the number of recurrences of the search being the base of the suggestion.

Returns:
the number of recurrences

getSearchQuery

public final java.lang.String getSearchQuery()
returns the search query of the search being the base of the suggestion.

Returns:
the query

addRecurrence

public final void addRecurrence(long h,
                                long i)
adds another recurrence of the search being the base of the suggestion with the given number of results.

Parameters:
h - the number of results
i - the penalty interval, i.e. the minimum interval between two subsequent recurrences without being considered a flooding attack

getImportance

public final double getImportance()
returns the importance of the suggestion for ordering, a value between 0 and 1.

Returns:
the importance

shortenSearch

public static java.lang.String shortenSearch(java.lang.String search)
shortens the given search string to be 80 characters or shorter, if possible at a space character.

Parameters:
search - the search string
Returns:
the shortened search string