public class AdminSolrMgr extends AdminBaseMgr implements AdminSolrMgrIf
| Modifier and Type | Class and Description |
|---|---|
protected class |
AdminSolrMgr.StaticData
Used to store the static data of this manager
|
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
END
Static variable for constructing string when adding a product
|
protected static org.apache.commons.logging.Log |
log
the log
|
protected static java.lang.String |
MIDDLE
Static variable for constructing string when adding a product
|
protected static java.lang.String |
mutex
mutex
|
protected static boolean |
PDFReaderPresent
this is set to true if the PDF reader classes are found
|
private java.util.Random |
rnd
For random number generation
|
protected static java.lang.String |
START
Static variable for constructing string when adding a product
|
protected static java.util.Map<java.lang.String,AdminSolrMgr.StaticData> |
staticDataHM
Hash Map that contains the static data
|
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> |
topLevelCatMap
Map to temporarily store top level category id for a category
|
static int |
TT_CAT
static variable for term type
|
static int |
TT_CAT_MANU
static variable for term type
|
static int |
TT_MANU
static variable for term type
|
static int |
TT_MANU_CAT
static variable for term type
|
static int |
TT_MODEL
static variable for term type
|
static int |
TT_NAME
static variable for term type
|
protected static java.lang.String |
TYPE_PDF
static variable for file type
|
protected static java.lang.String |
TYPE_TEXT
static variable for file type
|
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, debugStackTraceExclusions, kkAdminPropsFilePath, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir| Constructor and Description |
|---|
AdminSolrMgr(KKAdminIf eng)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAllProductsToSearchEngine(boolean async)
Loop through all of the products in the KonaKart database and add them to the Solr search
engine.
|
void |
addAllProductsToSearchEngineMultiThreadedSync()
Uses a configurable number of threads to populate Solr with KonaKart products
|
protected void |
addAllProductsToSearchEnginePrivate(AdminDataDescriptor dd,
AdminProductSearch ps)
Loop through all of the products in the KonaKart database and add them to the Solr search
engine.
|
void |
addAllProductsToSearchEngineSync()
Loop through all of the products in the KonaKart database and add them to the Solr search
engine.
|
void |
addProductToSearchEngine(int productId)
Add a single product referenced by productId to the Solr search engine
|
void |
addProductToSearchEngine(int productId,
java.lang.String storeId)
Add a single product referenced by productId to the Solr search engine.
|
protected void |
addSpelling(java.lang.StringBuffer sb,
AdminProduct prod,
AdminManufacturer manu,
java.util.HashMap<java.lang.Integer,AdminLanguage> langMap,
java.lang.String storeId,
AdminSolrMgr.StaticData sd,
java.lang.String catalogId)
Method to populate a field with text that provides spelling suggestions.
|
protected void |
addSpellings(java.lang.StringBuffer sb,
AdminProduct prod,
AdminManufacturer manu,
java.util.HashMap<java.lang.Integer,AdminLanguage> langMap,
java.lang.String storeId,
AdminSolrMgr.StaticData sd,
java.util.ArrayList<java.lang.String> catalogIdList)
Method calls the addSpelling method once for every catalog id
|
protected void |
addTerm(int type,
java.lang.StringBuffer sb,
java.lang.String langCode,
java.lang.String term,
int prodId,
int catId,
int manuId,
java.lang.String storeId,
java.lang.String catalogId,
int parentCatId)
Common code to add a term for dynamic suggested searching
|
protected void |
addTerms(int type,
java.lang.StringBuffer sb,
java.lang.String langCode,
java.lang.String term,
int prodId,
int catId,
int manuId,
java.lang.String storeId,
java.util.ArrayList<java.lang.String> catalogIdList,
int parentCatId)
Method calls the addTerm method once for every catalog id
|
protected void |
beforeAddProduct(java.lang.StringBuffer addProdData,
AdminProduct prod,
java.lang.String storeId,
java.util.HashMap<java.lang.Integer,AdminLanguage> langMap)
This method offers an opportunity to modify the data sent to Solr when adding a product.
|
private void |
checkPDFReaderPresent() |
boolean |
commitInCode()
Returns true if we should commit to Solr in code, otherwise it returns false
|
protected AdminDataDescriptor |
getAdminDataDescriptorForMultiThreadedAdd()
Returns an AdminDataDescriptor object used in the product search of the multi-threaded add to
fetch products to be added.
|
protected AdminProductSearch |
getAdminProductSearchForMultiThreadedAdd()
Returns an AdminProductSearch object used in the product search of the multi-threaded add to
fetch products to be added.
|
protected java.lang.String |
getAttachmentText(AdminProduct product)
Returns the text from the attachment so that it can be indexed in SOLR
|
protected java.util.ArrayList<java.lang.String> |
getCatalogIdsForProduct(AdminSolrMgr.StaticData sd,
int prodId)
Returns an array of catalog ids for which the product is defined
|
protected java.lang.String |
getCustomSearchData(AdminProduct prod,
AdminLanguage lang)
A method that can be overidden to supply data from a product object that is not normally
indexed in Solr.
|
java.lang.StringBuffer |
getDocFromProduct(int productId,
java.lang.String storeId,
java.util.HashMap<java.lang.Integer,AdminLanguage> languageMap)
Create an XML string from the product object that can be passed to Solr
|
protected java.lang.String |
getFileType(java.lang.String filePath)
Returns the file extension
|
java.util.HashMap<java.lang.Integer,AdminLanguage> |
getLangMap()
Returns a HashMap mapping language id to language
|
protected int |
getMaxWaitSecsForMultiThreadedAddGracefulShutdown() |
protected int |
getNumberOfThreadsForMultiThreadedAdd() |
int |
getSolrCommitFrequency()
The chunk size of records read from the database and written to SOLR after which a SOLR
commit command is sent.
|
java.net.URL |
getSolrUrl()
Derive a Solr Url from configuration variables.
|
protected int |
getTopLevelCatId(int catId)
Find the top level category for a category
|
protected void |
isEnabled()
Throws an exception if Solr isn't enabled.
|
protected static boolean |
isPDFReaderPresent() |
void |
refreshConfigs()
Refresh the configuration of the Admin Solr Manager
|
void |
removeAllProductsFromSearchEngine(boolean async)
Remove all products from the Solr search engine.
|
void |
removeAllProductsFromSearchEngineSync()
Remove all products from the Solr search engine
|
void |
removeProductFromSearchEngine(int productId)
Remove a single product referenced by productId from the Solr search engine
|
void |
removeProductFromSearchEngine(int productId,
java.lang.String storeId)
Remove a single product referenced by productId from the Solr search engine.
|
protected void |
sendProductsToSearchEngineMultiThreaded(AdminProducts prods,
java.util.HashMap<java.lang.Integer,AdminLanguage> langMap,
java.net.URL solrUrl)
Called by the Solr sender in a separate thread
|
protected static void |
setPDFReaderPresent(boolean readerPresent) |
boolean |
useSolr()
Returns true if Solr can be used, otherwise it returns false
|
addInsertAttr, addInsertAttr, addStringRuleConstraint, addStringRuleConstraint, checkAPICallEnabled, checkIntInRange, checkIntIsSet, checkRequired, executeQuery, executeQuery, getAdminAddressMgr, getAdminAuditMgr, getAdminBillingMgr, getAdminBookableProductMgr, getAdminCatMgr, getAdminConfigMgr, getAdminContentMgr, getAdminCurrMgr, getAdminCustMgr, getAdminCustPwdHistMgr, getAdminCustTagMgr, getAdminEmailMgr, getAdminEng, getAdminEngineCacheMgr, getAdminEventMgr, getAdminExecuteMgr, getAdminFileMgr, getAdminFilterMgr, getAdminHtmlMgr, getAdminImportMgr, getAdminLanguageMgr, getAdminManuMgr, getAdminMessageMgr, getAdminMiscItemMgr, getAdminMiscPriceMgr, getAdminModulesMgr, getAdminMultiStoreMgr, getAdminOrderMgr, getAdminPdfMgr, getAdminProdAttrMgr, getAdminProdMgr, getAdminPromMgr, getAdminReviewMgr, getAdminSearchRuleMgr, getAdminSecMgr, getAdminServletMgr, getAdminShipmentMgr, getAdminSolrMgr, getAdminStoreMgr, getAdminSuggestionMgr, getAdminTagMgr, getAdminTaxMgr, getAdminValidationMgr, getAdminVelocityContextMgr, getAdminWishListMgr, getBooleanFromString, getDebugStackTraceExclusions, getEmailThreadGracefulShutdownTimeout, getExportMgr, getExportMgr, getExportXMLData, getIntFromString, getKkAdminPropsFilePath, getKkConfig, getKkInstanceId, getMode, getModeString, getMqMgr, getNewCriteria, getNewCriteria, getNewCriteria, getNewCriteria, getOtherModuleByName, getPostSearchText, getPreSearchText, getProductsToCategoresCriteria, getPropertyValue, getPropertyValue, getPropertyValueAsBool, getPropertyValueAsInt, getPropertyValueAsLong, getRecordCount, getRecordCount, getRewardPointMgr, getSingleIntResult, getStoreId, getTemplate, getTemplateBase, getXml_io, init, insertKKEvent, insertKKEvent, isBusiness, isBusinessOrEnterprise, isCommunity, isConfigSet, isEnterprise, isMultiStoreLanguagesShared, isMultiStoreMode, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareCustomersOrProducts, isMultiStoreShareProducts, isMultiStoreSingleDBCSMode, isMultiStoreSingleDBMode, isMultiStoreSingleDBNonCSMode, isUnix, isWindows, manageException, manageThrowable, removeCData, sendMQMessages, setAdminEng, setDebugStackTraceExclusions, setKkAdminPropsFilePath, setupWildCardRules, setWildCardAfter, setWildCardBefore, shutdownGracefully, shutdownGracefully, timestampStr, updateStaticVariablesNowprotected static org.apache.commons.logging.Log log
protected static java.lang.String mutex
private java.util.Random rnd
protected static java.util.Map<java.lang.String,AdminSolrMgr.StaticData> staticDataHM
protected static final java.lang.String START
protected static final java.lang.String MIDDLE
protected static final java.lang.String END
protected static final java.lang.String TYPE_TEXT
protected static final java.lang.String TYPE_PDF
public static final int TT_CAT
public static final int TT_MANU
public static final int TT_CAT_MANU
public static final int TT_MANU_CAT
public static final int TT_NAME
public static final int TT_MODEL
protected static boolean PDFReaderPresent
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> topLevelCatMap
public AdminSolrMgr(KKAdminIf eng) throws java.lang.Exception
eng - the Admin Enginejava.lang.Exception - an unexpected exceptionpublic void addAllProductsToSearchEngine(boolean async)
throws java.lang.Exception
addAllProductsToSearchEngine in interface AdminSolrMgrIfasync - If true, the API call runs asynchronously and control is returned immediatelyjava.lang.Exception - an unexpected exceptionpublic void addAllProductsToSearchEngineSync()
throws java.lang.Exception
addAllProductsToSearchEngineSync in interface AdminSolrMgrIfjava.lang.Exception - an unexpected exceptionprotected void addAllProductsToSearchEnginePrivate(AdminDataDescriptor dd, AdminProductSearch ps) throws java.lang.Exception
dd - AdminDataDescriptor used for the product searchps - AdminProductSearch used for the product searchjava.lang.Exception - an unexpected exceptionpublic int getSolrCommitFrequency()
getSolrCommitFrequency in interface AdminSolrMgrIfpublic void addAllProductsToSearchEngineMultiThreadedSync()
throws java.lang.Exception
java.lang.Exception - an unexpected exceptionprotected void sendProductsToSearchEngineMultiThreaded(AdminProducts prods, java.util.HashMap<java.lang.Integer,AdminLanguage> langMap, java.net.URL solrUrl) throws java.lang.Exception
prods - An array of products to be sent to SolrlangMap - Map of languagessolrUrl - The Solr URLjava.lang.Exception - an unexpected exceptionprotected AdminDataDescriptor getAdminDataDescriptorForMultiThreadedAdd() throws KKAdminException
KKAdminException - an unexpected exception in the KonaKart Admin Engineprotected AdminProductSearch getAdminProductSearchForMultiThreadedAdd()
protected int getNumberOfThreadsForMultiThreadedAdd()
throws KKAdminException
KKAdminException - an unexpected exception in the KonaKart Admin Engineprotected int getMaxWaitSecsForMultiThreadedAddGracefulShutdown()
throws KKAdminException
KKAdminException - an unexpected exception in the KonaKart Admin Enginepublic void removeAllProductsFromSearchEngine(boolean async)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
java.lang.Exception
removeAllProductsFromSearchEngine in interface AdminSolrMgrIfasync - If true we do it asynchronouslyorg.apache.torque.TorqueException - an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException - an unexpected exception due to data in Torque (the database layer)java.lang.Exception - an unexpected exceptionpublic void removeAllProductsFromSearchEngineSync()
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
java.lang.Exception
removeAllProductsFromSearchEngineSync in interface AdminSolrMgrIforg.apache.torque.TorqueException - an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException - an unexpected exception due to data in Torque (the database layer)java.lang.Exception - an unexpected exceptionpublic void removeProductFromSearchEngine(int productId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
java.lang.Exception
removeProductFromSearchEngine in interface AdminSolrMgrIfproductId - the productIdorg.apache.torque.TorqueException - an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException - an unexpected exception due to data in Torque (the database layer)java.lang.Exception - an unexpected exceptionpublic void removeProductFromSearchEngine(int productId,
java.lang.String storeId)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException,
java.lang.Exception
removeProductFromSearchEngine in interface AdminSolrMgrIfproductId - the productIdstoreId - the storeIdorg.apache.torque.TorqueException - an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException - an unexpected exception due to data in Torque (the database layer)java.lang.Exception - an unexpected exceptionpublic void addProductToSearchEngine(int productId,
java.lang.String storeId)
throws java.lang.Exception
addProductToSearchEngine in interface AdminSolrMgrIfproductId - the productIdstoreId - the storeIdjava.lang.Exception - an unexpected exceptionpublic void addProductToSearchEngine(int productId)
throws java.lang.Exception
addProductToSearchEngine in interface AdminSolrMgrIfproductId - the productIdjava.lang.Exception - an unexpected exceptionpublic java.util.HashMap<java.lang.Integer,AdminLanguage> getLangMap() throws java.lang.Exception
getLangMap in interface AdminSolrMgrIfjava.lang.Exception - an unexpected exceptionpublic java.lang.StringBuffer getDocFromProduct(int productId,
java.lang.String storeId,
java.util.HashMap<java.lang.Integer,AdminLanguage> languageMap)
throws java.lang.Exception
getDocFromProduct in interface AdminSolrMgrIfproductId - the productIdstoreId - the storeIdlanguageMap - the languageMapjava.lang.Exception - an unexpected exceptionprotected java.util.ArrayList<java.lang.String> getCatalogIdsForProduct(AdminSolrMgr.StaticData sd, int prodId) throws java.lang.Exception
sd - the sdprodId - the prodIdjava.lang.Exception - an unexpected exceptionprotected void beforeAddProduct(java.lang.StringBuffer addProdData,
AdminProduct prod,
java.lang.String storeId,
java.util.HashMap<java.lang.Integer,AdminLanguage> langMap)
addProdData - A string buffer containing data that will be sent to Solr. Extra data may be
appended to the string buffer and / or the data it currently contains may be
modified.prod - The product being added to SolrstoreId - The store idlangMap - A hash map containing the current languagesprotected void addTerms(int type,
java.lang.StringBuffer sb,
java.lang.String langCode,
java.lang.String term,
int prodId,
int catId,
int manuId,
java.lang.String storeId,
java.util.ArrayList<java.lang.String> catalogIdList,
int parentCatId)
throws java.lang.Exception
type - the typesb - the sblangCode - the langCodeterm - the termprodId - the prodIdcatId - the catIdmanuId - the manuIdstoreId - the storeIdcatalogIdList - the catalogIdListparentCatId - the parentCatIdjava.lang.Exception - an unexpected exceptionprotected void addTerm(int type,
java.lang.StringBuffer sb,
java.lang.String langCode,
java.lang.String term,
int prodId,
int catId,
int manuId,
java.lang.String storeId,
java.lang.String catalogId,
int parentCatId)
throws java.lang.Exception
type - Used when specializing this method to decide whether to not include certain terms
in the search.sb - the sblangCode - the langCodeterm - the termprodId - the prodIdcatId - the catIdmanuId - the manuIdstoreId - the storeIdcatalogId - the catalogIdparentCatId - the parentCatIdjava.lang.Exception - an unexpected exceptionprotected void addSpellings(java.lang.StringBuffer sb,
AdminProduct prod,
AdminManufacturer manu,
java.util.HashMap<java.lang.Integer,AdminLanguage> langMap,
java.lang.String storeId,
AdminSolrMgr.StaticData sd,
java.util.ArrayList<java.lang.String> catalogIdList)
throws KKAdminException
sb - the sbprod - the prodmanu - the manulangMap - the langMapstoreId - the storeIdsd - the sdcatalogIdList - the catalogIdListKKAdminException - unexpected exception in the KonaKart Admin Engineprotected void addSpelling(java.lang.StringBuffer sb,
AdminProduct prod,
AdminManufacturer manu,
java.util.HashMap<java.lang.Integer,AdminLanguage> langMap,
java.lang.String storeId,
AdminSolrMgr.StaticData sd,
java.lang.String catalogId)
throws KKAdminException
sb - the sbprod - the prodmanu - the manulangMap - the langMapstoreId - the storeIdsd - the sdcatalogId - the catalogIdKKAdminException - unexpected exception in the KonaKart Admin Engineprotected java.lang.String getAttachmentText(AdminProduct product) throws java.lang.Exception
product - the productjava.lang.Exception - an unexpected exceptionprivate void checkPDFReaderPresent()
throws KKAdminException
KKAdminExceptionprotected java.lang.String getFileType(java.lang.String filePath)
filePath - the filePathpublic java.net.URL getSolrUrl()
throws java.lang.Exception
getSolrUrl in interface AdminSolrMgrIfjava.lang.Exception - an unexpected exceptionpublic void refreshConfigs()
throws java.lang.Exception
refreshConfigs in interface AdminSolrMgrIfrefreshConfigs in class AdminBaseMgrjava.lang.Exception - an unexpected exceptionpublic boolean useSolr()
throws java.lang.Exception
useSolr in interface AdminSolrMgrIfjava.lang.Exception - an unexpected exceptionpublic boolean commitInCode()
throws java.lang.Exception
commitInCode in interface AdminSolrMgrIfjava.lang.Exception - an unexpected exceptionprotected void isEnabled()
throws java.lang.Exception
java.lang.Exception - an unexpected Exception exceptionprotected static boolean isPDFReaderPresent()
protected static void setPDFReaderPresent(boolean readerPresent)
readerPresent - the pDFReaderPresent to setprotected java.lang.String getCustomSearchData(AdminProduct prod, AdminLanguage lang)
This indexed data will only be used by the storefront APIs when you set
whereToSearch in the ProductSearch object to
ProductSearch.SEARCH_IN_PRODUCT_DESCRIPTION
prod - A full AdminProduct objectlang - The language currently being indexedprotected int getTopLevelCatId(int catId)
throws java.lang.Exception
catId - the catIdjava.lang.Exception - an unexpected exceptionCopyright © 2018 DS Data Systems UK Ltd.