Skip to content

Commit

Permalink
CONNECTORS-1747: Add global config flag to disable hopcount tracking …
Browse files Browse the repository at this point in the history
…completely

git-svn-id: https://svn.apache.org/repos/asf/manifoldcf/trunk@1910036 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
kwrightapache committed May 24, 2023
1 parent 234d2f1 commit 510e6b8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ $Id$
CONNECTORS-1743: Retry on 502 and 503 errors in Solr connector.
(Markus G�nther)

CONNECTORS-1747: Add global property to disable hopcount for all connectors.
(Mingchun Zhao)

======================= Release 2.24 =====================

CONNECTORS-1739: Reuse escaping facilities.
Expand Down
15 changes: 13 additions & 2 deletions framework/crawler-ui/src/main/webapp/editjob.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ try
INotificationConnectorPool notificationConnectorPool = NotificationConnectorPoolFactory.make(threadContext);
ITransformationConnectorPool transformationConnectorPool = TransformationConnectorPoolFactory.make(threadContext);
ILockManager lockManager = LockManagerFactory.make(threadContext);
/** If the global cluster property "storehopcount" is set to false(defaults to true), disable support for hopcount handling completely,
* the "Hop Filters" tab should not appear in the UI for any job.
*/
Boolean storeHopCount = lockManager.getSharedConfiguration().getBooleanProperty("org.apache.manifoldcf.crawler.jobs.storehopcount",true);
// Figure out tab name and sequence number
String tabName = variableContext.getParameter("tabname");
String tabSequenceNumber = variableContext.getParameter("sequencenumber");
Expand Down Expand Up @@ -218,7 +225,7 @@ try
{
tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Scheduling"));
sequenceArray.add(null);
if (relationshipTypes != null && relationshipTypes.length > 0)
if (storeHopCount && relationshipTypes != null && relationshipTypes.length > 0)
{
tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editjob.HopFilters"));
sequenceArray.add(null);
Expand Down Expand Up @@ -902,7 +909,11 @@ function isRegularExpression(value)
}
// Hop Filters tab
if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.HopFilters")) && tabSequenceInt == -1)
if (!storeHopCount)
{
// Do nothing
}
else if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.HopFilters")) && tabSequenceInt == -1)
{
if (relationshipTypes != null)
{
Expand Down
9 changes: 8 additions & 1 deletion framework/crawler-ui/src/main/webapp/viewjob.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ try
INotificationConnectorPool notificationConnectorPool = NotificationConnectorPoolFactory.make(threadContext);
ITransformationConnectorPool transformationConnectorPool = TransformationConnectorPoolFactory.make(threadContext);
ILockManager lockManager = LockManagerFactory.make(threadContext);
/** If the global cluster property "storehopcount" is set to false(defaults to true), disable support for hopcount handling completely,
* the hopcount information should not appear in the UI for any job.
*/
Boolean storeHopCount = lockManager.getSharedConfiguration().getBooleanProperty("org.apache.manifoldcf.crawler.jobs.storehopcount",true);
String jobID = variableContext.getParameter("jobid");
IJobDescription job = manager.load(new Long(jobID));
if (job == null)
Expand Down Expand Up @@ -595,7 +602,7 @@ try
}
}
if (relationshipTypes != null && relationshipTypes.length > 0)
if (storeHopCount && relationshipTypes != null && relationshipTypes.length > 0)
{
int k = 0;
while (k < relationshipTypes.length)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ public class HopCount extends org.apache.manifoldcf.core.database.BaseTable
/** Thread context */
protected IThreadContext threadContext;

/** Lock manager */
protected final ILockManager lockManager;

/** If the global cluster property "storehopcount" is set to false(defaults to true), disable support for hopcount handling completely,
* the hopcount will never be recorded in the "intrinsiclink" or "hopcount" tables for any job at all.
*/
protected static Boolean storeHopCount = true;

/** Constructor.
*@param database is the database handle.
*/
Expand All @@ -158,6 +166,8 @@ public HopCount(IThreadContext tc, IDBInterface database)
this.threadContext = tc;
intrinsicLinkManager = new IntrinsicLink(database);
deleteDepsManager = new HopDeleteDeps(database);
lockManager = LockManagerFactory.make(tc);
storeHopCount = lockManager.getSharedConfiguration().getBooleanProperty("org.apache.manifoldcf.crawler.jobs.storehopcount",true);
}

/** Install or upgrade.
Expand Down Expand Up @@ -389,6 +399,12 @@ protected boolean[] doRecord(Long jobID, String[] legalLinkTypes, String sourceD
// this method would need to be revised to not process any additions until the finishParents() call
// is made. At the moment, revertParents() is not used by any thread.
// TBD, MHL
if (!storeHopCount)
{
// Do nothing
return null;
}

boolean[] rval = new boolean[targetDocumentIDHashes.length];
for (int i = 0; i < rval.length; i++)
{
Expand Down

0 comments on commit 510e6b8

Please sign in to comment.