com.plumtree.server.search.admin
Interface IPTSearchBestBetMaintenance

All Superinterfaces:
IPTUnknown

public interface IPTSearchBestBetMaintenance
extends IPTUnknown

Interface for an object used to maintain search Best Bets. Best Bets are mappings from user search queries to (up to) 20 top-ranked results; they allow an administrator to hardwire certain common searches to known good results that wouldn't necessarily rank at the top otherwise.

The main underlying Best Bet store is the database. Best Bets are also added to the search server (which is how they are retrieved during a search). There is no limit to the # of Best Bets - there could be thousands or 10s of thousands of entries, so this class gives you a view into the Best Bets list. Call "SetStartCount" to set the start count (first item is 1, not 0), and "SetNumResultsAskedFor" to set the location and size of the window. (defaults are startCount = 1 & numResultsAskedFor = 10). This window is called the "display list" The call "RefreshDisplayList()" fills in the display list using the two parameters above. The list of Best Bets is sorted in ascending alphabetical order by trigger id. Making "Add" and "Delete" calls in this class does not update the database & search server right away. The changes are kept in memory until "ApplyChanges()" is called. In order to be able to calculate the view window into the list of Best Bets, the display list has the following quirks:

The normal usage pattern for this object is as follows:

Version:
$Revision$
Author:
SamirM

Method Summary
 void AddBestBet(java.lang.String strTrigger, java.lang.String strSetupString, com.plumtree.openfoundation.util.IXPList arrTargets)
          Add a new Best Bet to the add list.
 void ApplyChanges()
          Saves all changes to the database and commits to the search server.
 boolean CanAddBestBet(java.lang.String oldTrigger, java.lang.String newTrigger, boolean bIsNewlyAdded)
          Checks wether a particular Best Bet is addable or not.
 void CancelChanges()
          Undoes all changes made.
 void DeleteAll()
          Deletes all Best Bets.
 void DeleteByTriggerString(java.lang.String[] triggers)
          Takes a list of trigger string, and deletes those triggers.
 void DeleteFromDisplayedList(int[] ids)
          Takes a list of indices into the displayed list array, and marks the best bets for deletion.
 IPTSResult FindFirstTargetForTrigger(java.lang.String trigger, IPTSField[] arrFieldsToReturn)
          Like the other Find calls, this method should not strictly be here.
 com.plumtree.openfoundation.util.IXPList FindTriggersContainingTarget(java.lang.String id, java.lang.String type)
          This method should not strictly be here since it has little to do with maintenance.
 com.plumtree.openfoundation.util.IXPList FindTriggersWithFirstTarget(java.lang.String id, java.lang.String type)
          This method should not strictly be here since it has little to do with maintenance.
 int GetAddedCount()
          Get a count of the # of items added since the last commit.
 int GetDeletedCount()
          Get a count of the # of items deleted since the last commit.
 int GetDisplayedCount()
          Get the # of displayed items.
 java.lang.String GetDisplayedItemSetupString(int i)
          Get the item setup string.
 com.plumtree.openfoundation.util.IXPList GetDisplayedItemTargets(int i)
          Gets an IXPList of IPTBestBetTarget items.
 java.lang.String GetDisplayedItemTrigger(int i)
          Get the item's trigger string.
 boolean GetShowingAll()
          Determine of there is a query restriction or if all Best Bets are being displayed.
 int GetTotalCount()
          Get the total count of Best Bets.
 boolean HasBestBetBeenDeleted(java.lang.String trigger)
          Returns true if the Best Bet with the given trigger string has been deleted since the last "ApplyChanges()" call.
 boolean HasDisplayedItemBeenDeleted(int i)
          Returns true if the display item at the given index has been deleted since the last "ApplyChanges()" call.
 boolean HasDisplayedItemBeenNewlyAdded(int i)
          Returns true if the display item at the given index was newly added since the last "ApplyChanges()" call.
 void RefreshDisplayList()
          Call to refresh the display list.
 void SetNumResultsAskedFor(int nResults)
          Set the number of items to get when fetching Best Bets (size of view window).
 void SetSearchString(java.lang.String strSearch)
          Set the search string to use to limit the display list.
 void SetShowingAll(boolean bShowAllBBs)
          When set to true, removes any search restriction that exists.
 void SetStartCount(int nStartCount)
          Set the start count (starting at 1) to use when fetching Best Bets.
 void UpdateBestBet(java.lang.String strOldTrigger, boolean bIsFromDB, java.lang.String strTrigger, java.lang.String strSetupString, com.plumtree.openfoundation.util.IXPList arrTargets)
          Update an existing Best Bet.
 
Methods inherited from interface com.plumtree.server.IPTUnknown
GetInterfaces
 

Method Detail

CanAddBestBet

boolean CanAddBestBet(java.lang.String oldTrigger,
                      java.lang.String newTrigger,
                      boolean bIsNewlyAdded)
Checks wether a particular Best Bet is addable or not. It may be addable if a Best Bet with the same newTrigger already exists. This call will throw an exception if called by anyone but the administrator.


DeleteFromDisplayedList

void DeleteFromDisplayedList(int[] ids)
Takes a list of indices into the displayed list array, and marks the best bets for deletion. This call will throw an exception if called by anyone but the administrator.


DeleteByTriggerString

void DeleteByTriggerString(java.lang.String[] triggers)
Takes a list of trigger string, and deletes those triggers. This call will throw an exception if called by anyone but the administrator.


DeleteAll

void DeleteAll()
Deletes all Best Bets. This call will throw an exception if called by anyone but the administrator.


AddBestBet

void AddBestBet(java.lang.String strTrigger,
                java.lang.String strSetupString,
                com.plumtree.openfoundation.util.IXPList arrTargets)
Add a new Best Bet to the add list. This call will throw an exception if called by anyone but the administrator.


UpdateBestBet

void UpdateBestBet(java.lang.String strOldTrigger,
                   boolean bIsFromDB,
                   java.lang.String strTrigger,
                   java.lang.String strSetupString,
                   com.plumtree.openfoundation.util.IXPList arrTargets)
Update an existing Best Bet. This call will throw an exception if called by anyone but the administrator.


ApplyChanges

void ApplyChanges()
Saves all changes to the database and commits to the search server. This call will throw an exception if called by anyone but the administrator.


CancelChanges

void CancelChanges()
Undoes all changes made. This call will throw an exception if called by anyone but the administrator.


RefreshDisplayList

void RefreshDisplayList()
Call to refresh the display list. This call will throw an exception if called by anyone but the administrator.


GetAddedCount

int GetAddedCount()
Get a count of the # of items added since the last commit.


GetDeletedCount

int GetDeletedCount()
Get a count of the # of items deleted since the last commit.


GetDisplayedCount

int GetDisplayedCount()
Get the # of displayed items.


GetTotalCount

int GetTotalCount()
Get the total count of Best Bets.


GetShowingAll

boolean GetShowingAll()
Determine of there is a query restriction or if all Best Bets are being displayed.


GetDisplayedItemSetupString

java.lang.String GetDisplayedItemSetupString(int i)
Get the item setup string. (the search string used to find targets)


GetDisplayedItemTrigger

java.lang.String GetDisplayedItemTrigger(int i)
Get the item's trigger string.


GetDisplayedItemTargets

com.plumtree.openfoundation.util.IXPList GetDisplayedItemTargets(int i)
Gets an IXPList of IPTBestBetTarget items.


HasDisplayedItemBeenDeleted

boolean HasDisplayedItemBeenDeleted(int i)
Returns true if the display item at the given index has been deleted since the last "ApplyChanges()" call.

Parameters:
i -
Returns:

HasDisplayedItemBeenNewlyAdded

boolean HasDisplayedItemBeenNewlyAdded(int i)
Returns true if the display item at the given index was newly added since the last "ApplyChanges()" call.

Parameters:
i -
Returns:
true or false

HasBestBetBeenDeleted

boolean HasBestBetBeenDeleted(java.lang.String trigger)
Returns true if the Best Bet with the given trigger string has been deleted since the last "ApplyChanges()" call.

Parameters:
trigger -
Returns:

SetSearchString

void SetSearchString(java.lang.String strSearch)
Set the search string to use to limit the display list. The wildcard character "*" is allowed at the end of the string. If the "*" is not the last character, the search string will be truncated upto the "*". This call has no effect until "RefreshDisplayList()" is called.

Parameters:
strSearch -

SetStartCount

void SetStartCount(int nStartCount)
Set the start count (starting at 1) to use when fetching Best Bets. This call has no effect until "RefreshDisplayList()" is called.

Parameters:
nStartCount -

SetNumResultsAskedFor

void SetNumResultsAskedFor(int nResults)
Set the number of items to get when fetching Best Bets (size of view window). This call has no effect until "RefreshDisplayList()" is called.

Parameters:
nResults -

SetShowingAll

void SetShowingAll(boolean bShowAllBBs)
When set to true, removes any search restriction that exists. This call has no effect until "RefreshDisplayList()" is called.

Parameters:
bShowAllBBs -

FindTriggersContainingTarget

com.plumtree.openfoundation.util.IXPList FindTriggersContainingTarget(java.lang.String id,
                                                                      java.lang.String type)
This method should not strictly be here since it has little to do with maintenance. Given a document's id & type, it looks up and returns all Best Bet trigger strings where the document is a target This is an unsecured check that does not use ACLs at all. For Portal objects, id is 'XPConvert.ToString(classID) + "." + XPConvert.ToString(objectID)', and type is "PTPORTAL"

Parameters:
id - id of target document
type - type of target document
Returns:
IXPList of trigger strings. (XPArrayList of Strings)

FindTriggersWithFirstTarget

com.plumtree.openfoundation.util.IXPList FindTriggersWithFirstTarget(java.lang.String id,
                                                                     java.lang.String type)
This method should not strictly be here since it has little to do with maintenance. Given a document's id & type, it looks up and returns all Best Bet trigger strings where the document is the first target. This is an unsecured check that does not use ACLs at all. This is used for looking up keywords. For Portal objects, id is 'XPConvert.ToString(classID) + "." + XPConvert.ToString(objectID)', and type is "PTPORTAL"

Parameters:
id - id of target document
type - type of target document
Returns:
IXPList of trigger strings. (XPArrayList of Strings)

FindFirstTargetForTrigger

IPTSResult FindFirstTargetForTrigger(java.lang.String trigger,
                                     IPTSField[] arrFieldsToReturn)
Like the other Find calls, this method should not strictly be here. Given a Best Bet trigger string, this method returns the first best bet target. If the calling user does not have access to the first target document, or if the trigger does not exist, a null IPTSResult is returned. The IPTSResult returned will always have these fields: PortalCollection().Application(), PortalCollection().FolderACL(), PortalCollection().ReadACL(), ContentCollection().ACL(), and CollabCollection().ACL(), so those fields do not need to be retrieved.

Parameters:
trigger - - Query string
arrFieldsToReturn - - Array of fields to return.
Returns:
IPTSResult for the item, or null.