com.plumtree.server
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) three 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 normal usage pattern for this object is not completely obvious:

If your only modification is to insert a new best bet, then there is no need to clear or re-add the previously defined best bets.


Method Summary
 void Clear()
          Clears all best bets out of this object, usually in preparation for replacing them by repeated calls to GetNewBBIdAndAdd().
 int GetNewBBIdAndAdd(java.lang.String queryString, int numTargets, java.lang.String target1Key1, java.lang.String target1Key2, java.lang.String target1Name, java.lang.String target2Key1, java.lang.String target2Key2, java.lang.String target2Name, java.lang.String target3Key1, java.lang.String target3Key3, java.lang.String target3Name)
          Adds a new Best Bet to the collection in memory, and returns a numeric id for the best bet that may be used in future calls to GetQueryString, GetTargetKeyX, and GetTargetName.
 int GetNumBBsDefinedInDB()
          Call this method first to initialize the object from the database.
 int GetNumTargets(int nID)
          Returns the number of hardwired targets (top-ranked search results) for this best bet.
 java.lang.String GetQueryString(int nID)
          Returns the user search query that triggers the best bet with id nID.
 java.lang.String GetTargetKey1(int nID, int nTargetNum)
          Returns the first part of the search server key for the indicated best bet and target (result).
 java.lang.String GetTargetKey2(int nID, int nTargetNum)
          Returns the second part of the search server key for the indicated best bet and target (result).
 java.lang.String GetTargetName(int nID, int nTargetNum)
          Returns a displayable name for the indicated best bet target, usually just the name of the document or object.
 void ReplaceBBsInDB()
          Commits the best bets currently stored in this object to the database, replacing all best bets previously in the database.
 
Methods inherited from interface com.plumtree.server.IPTUnknown
GetInterfaces
 

Method Detail

Clear

public void Clear()
Clears all best bets out of this object, usually in preparation for replacing them by repeated calls to GetNewBBIdAndAdd().

GetNumBBsDefinedInDB

public int GetNumBBsDefinedInDB()
Call this method first to initialize the object from the database. It returns the number of Best Bets already defined.
Returns:
the number of Best Bets already defined in the database.

GetNewBBIdAndAdd

public int GetNewBBIdAndAdd(java.lang.String queryString,
                            int numTargets,
                            java.lang.String target1Key1,
                            java.lang.String target1Key2,
                            java.lang.String target1Name,
                            java.lang.String target2Key1,
                            java.lang.String target2Key2,
                            java.lang.String target2Name,
                            java.lang.String target3Key1,
                            java.lang.String target3Key3,
                            java.lang.String target3Name)
Adds a new Best Bet to the collection in memory, and returns a numeric id for the best bet that may be used in future calls to GetQueryString, GetTargetKeyX, and GetTargetName.

Ordinarily, a search is run just before calling this method, and the search results are used to determine the values of the key fields. Use the value returned by IPTSearchResponse.GetResultInternalField(PT_SEARCH_INTERNAL_FIELD.PT_SEARCH_IF_BESTBETKEY) as the first half of the key, and the value returned by IPTSearchResponse.GetResultApp() as the second half.

There is currently a limit of 30 best bets that may be defined at one time; if more than 30 are added this method will throw an exception.

Parameters:
queryString - the user's search query that will trigger this best bet
numTargets - the number of targets (search results) to force to be at the top of the result set; must be 1, 2, or 3
target1Key1 - First part of the search server key for target 1.
target1Key2 - Second part of the search server key for target 1.
target1Name - Displayable name for the first target; will be ignored in 5.0SP1 and later.
target2Key1 - First part of the search server key for target 2, or null.
target2Key2 - Second part of the search server key for target 2, or null.
target2Name - Displayable name for the second target; will be ignored in 5.0SP1 and later.
target3Key1 - First part of the search server key for target 3, or null.
target3Key2 - Second part of the search server key for target 3, or null.
target3Name - Displayable name for the third target; will be ignored in 5.0SP1 and later.
Returns:
a numeric id that may be used in calls to GetQueryString, GetTargetIeyX, and GetTargetName

ReplaceBBsInDB

public void ReplaceBBsInDB()
Commits the best bets currently stored in this object to the database, replacing all best bets previously in the database.

GetQueryString

public java.lang.String GetQueryString(int nID)
Returns the user search query that triggers the best bet with id nID.
Parameters:
nID - numeric ID of the best bet. 0-based, must be less than the value returned by GetNumBBsDefinedInDB (or a value returned by GetNewBBIdAndAdd).
Returns:
the user search query that triggers the best bet

GetNumTargets

public int GetNumTargets(int nID)
Returns the number of hardwired targets (top-ranked search results) for this best bet. Will always be 1, 2, or 3.
Parameters:
nID - numeric ID of the best bet. 0-based, must be less than the value returned by GetNumBBsDefinedInDB (or a value returned by GetNewBBIdAndAdd).
Returns:
the number of targets, 1, 2, or 3

GetTargetKey1

public java.lang.String GetTargetKey1(int nID,
                                      int nTargetNum)
Returns the first part of the search server key for the indicated best bet and target (result).
Parameters:
nID - numeric ID of the best bet. 0-based, must be less than the value returned by GetNumBBsDefinedInDB (or a value returned by GetNewBBIdAndAdd).
nTargetNum - target number desired; must be 1, 2, or 3.
Returns:
the first part of the search server key

GetTargetKey2

public java.lang.String GetTargetKey2(int nID,
                                      int nTargetNum)
Returns the second part of the search server key for the indicated best bet and target (result).
Parameters:
nID - numeric ID of the best bet. 0-based, must be less than the value returned by GetNumBBsDefinedInDB (or a value returned by GetNewBBIdAndAdd).
nTargetNum - target number desired; must be 1, 2, or 3.
Returns:
the second part of the search server key

GetTargetName

public java.lang.String GetTargetName(int nID,
                                      int nTargetNum)
Returns a displayable name for the indicated best bet target, usually just the name of the document or object.
Parameters:
nID - numeric ID of the best bet. 0-based, must be less than the value returned by GetNumBBsDefinedInDB (or a value returned by GetNewBBIdAndAdd).
nTargetNum - target number desired; must be 1, 2, or 3.
Returns:
a displayable name


Copyright © 2003 Plumtree Software Inc. All Rights Reserved.