You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2015/05/28 14:32:41 UTC
svn commit: r1682231 - in
/manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main:
java/org/apache/manifoldcf/agents/output/solr/
native2ascii/org/apache/manifoldcf/agents/output/solr/
Author: kwright
Date: Thu May 28 12:32:40 2015
New Revision: 1682231
URL: http://svn.apache.org/r1682231
Log:
Add support for original size attribute
Modified:
manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConfig.java
manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java
manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_en_US.properties
manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_ja_JP.properties
manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_zh_CN.properties
Modified: manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java?rev=1682231&r1=1682230&r2=1682231&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java (original)
+++ manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java Thu May 28 12:32:40 2015
@@ -100,6 +100,7 @@ public class HttpPoster
private final String allowAttributeName;
private final String denyAttributeName;
private final String idAttributeName;
+ private final String originalSizeAttributeName;
private final String modifiedDateAttributeName;
private final String createdDateAttributeName;
private final String indexedDateAttributeName;
@@ -131,7 +132,7 @@ public class HttpPoster
int zkClientTimeout, int zkConnectTimeout,
String updatePath, String removePath, String statusPath,
String allowAttributeName, String denyAttributeName, String idAttributeName,
- String modifiedDateAttributeName, String createdDateAttributeName, String indexedDateAttributeName,
+ String originalSizeAttributeName, String modifiedDateAttributeName, String createdDateAttributeName, String indexedDateAttributeName,
String fileNameAttributeName, String mimeTypeAttributeName, String contentAttributeName,
Long maxDocumentLength,
String commitWithin, boolean useExtractUpdateHandler)
@@ -147,6 +148,7 @@ public class HttpPoster
this.allowAttributeName = allowAttributeName;
this.denyAttributeName = denyAttributeName;
this.idAttributeName = idAttributeName;
+ this.originalSizeAttributeName = originalSizeAttributeName;
this.modifiedDateAttributeName = modifiedDateAttributeName;
this.createdDateAttributeName = createdDateAttributeName;
this.indexedDateAttributeName = indexedDateAttributeName;
@@ -179,7 +181,7 @@ public class HttpPoster
String updatePath, String removePath, String statusPath,
String realm, String userID, String password,
String allowAttributeName, String denyAttributeName, String idAttributeName,
- String modifiedDateAttributeName, String createdDateAttributeName, String indexedDateAttributeName,
+ String originalSizeAttributeName, String modifiedDateAttributeName, String createdDateAttributeName, String indexedDateAttributeName,
String fileNameAttributeName, String mimeTypeAttributeName, String contentAttributeName,
IKeystoreManager keystoreManager, Long maxDocumentLength,
String commitWithin, boolean useExtractUpdateHandler)
@@ -195,6 +197,7 @@ public class HttpPoster
this.allowAttributeName = allowAttributeName;
this.denyAttributeName = denyAttributeName;
this.idAttributeName = idAttributeName;
+ this.originalSizeAttributeName = originalSizeAttributeName;
this.modifiedDateAttributeName = modifiedDateAttributeName;
this.createdDateAttributeName = createdDateAttributeName;
this.indexedDateAttributeName = indexedDateAttributeName;
@@ -995,6 +998,14 @@ public class HttpPoster
}
// Write the rest of the attributes
+ if ( originalSizeAttributeName != null )
+ {
+ Long size = document.getOriginalSize();
+ if ( size != null )
+ {
+ outputDoc.addField( originalSizeAttributeName, size.toString() );
+ }
+ }
if ( modifiedDateAttributeName != null )
{
Date date = document.getModifiedDate();
@@ -1067,6 +1078,13 @@ public class HttpPoster
// Write the id field
writeField(out,LITERAL+idAttributeName,documentURI);
// Write the rest of the attributes
+ if (originalSizeAttributeName != null)
+ {
+ Long size = document.getOriginalSize();
+ if (size != null)
+ // Write value
+ writeField(out,LITERAL+modifiedDateAttributeName,size.toString());
+ }
if (modifiedDateAttributeName != null)
{
Date date = document.getModifiedDate();
Modified: manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConfig.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConfig.java?rev=1682231&r1=1682230&r2=1682231&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConfig.java (original)
+++ manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConfig.java Thu May 28 12:32:40 2015
@@ -83,6 +83,8 @@ public class SolrConfig
public static final String PARAM_STATUSPATH = "Server status handler";
/** Id field */
public static final String PARAM_IDFIELD = "Solr id field name";
+ /** Optional original size field */
+ public static final String PARAM_ORIGINALSIZEFIELD = "Solr original size field name";
/** Optional modified date field */
public static final String PARAM_MODIFIEDDATEFIELD = "Solr modified date field name";
/** Optional created date field */
Modified: manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java?rev=1682231&r1=1682230&r2=1682231&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java Thu May 28 12:32:40 2015
@@ -85,6 +85,7 @@ public class SolrConnector extends org.a
// Attributes going into Solr
protected String idAttributeName = null;
+ protected String originalSizeAttributeName = null;
protected String modifiedDateAttributeName = null;
protected String createdDateAttributeName = null;
protected String indexedDateAttributeName = null;
@@ -181,6 +182,7 @@ public class SolrConnector extends org.a
excludedMimeTypesString = null;
excludedMimeTypes = null;
idAttributeName = null;
+ originalSizeAttributeName = null;
modifiedDateAttributeName = null;
createdDateAttributeName = null;
indexedDateAttributeName = null;
@@ -214,6 +216,10 @@ public class SolrConnector extends org.a
if (idAttributeName == null || idAttributeName.length() == 0)
idAttributeName = "id";
+ originalSizeAttributeName = params.getParameter(SolrConfig.PARAM_ORIGINALSIZEFIELD);
+ if (originalSizeAttributeName == null || originalSizeAttributeName.length() == 0)
+ originalSizeAttributeName = null;
+
modifiedDateAttributeName = params.getParameter(SolrConfig.PARAM_MODIFIEDDATEFIELD);
if (modifiedDateAttributeName == null || modifiedDateAttributeName.length() == 0)
modifiedDateAttributeName = null;
@@ -355,7 +361,7 @@ public class SolrConnector extends org.a
connectTimeout,socketTimeout,
updatePath,removePath,statusPath,realm,userID,password,
allowAttributeName,denyAttributeName,idAttributeName,
- modifiedDateAttributeName,createdDateAttributeName,indexedDateAttributeName,
+ originalSizeAttributeName,modifiedDateAttributeName,createdDateAttributeName,indexedDateAttributeName,
fileNameAttributeName,mimeTypeAttributeName,contentAttributeName,
keystoreManager,maxDocumentLength,commitWithin,useExtractUpdateHandler);
@@ -411,7 +417,7 @@ public class SolrConnector extends org.a
zkClientTimeout,zkConnectTimeout,
updatePath,removePath,statusPath,
allowAttributeName,denyAttributeName,idAttributeName,
- modifiedDateAttributeName,createdDateAttributeName,indexedDateAttributeName,
+ originalSizeAttributeName,modifiedDateAttributeName,createdDateAttributeName,indexedDateAttributeName,
fileNameAttributeName,mimeTypeAttributeName,contentAttributeName,
maxDocumentLength,commitWithin,useExtractUpdateHandler);
@@ -1009,6 +1015,10 @@ public class SolrConnector extends org.a
String idField = parameters.getParameter(SolrConfig.PARAM_IDFIELD);
if (idField == null)
idField = "id";
+
+ String originalSizeField = parameters.getParameter(SolrConfig.PARAM_ORIGINALSIZEFIELD);
+ if (originalSizeField == null)
+ originalSizeField = "";
String modifiedDateField = parameters.getParameter(SolrConfig.PARAM_MODIFIEDDATEFIELD);
if (modifiedDateField == null)
@@ -1463,6 +1473,12 @@ public class SolrConnector extends org.a
" </td>\n"+
" </tr>\n"+
" <tr>\n"+
+" <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"SolrConnector.OriginalSizeFieldName") + "</nobr></td>\n"+
+" <td class=\"value\">\n"+
+" <input name=\"originalsizefield\" type=\"text\" size=\"32\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(originalSizeField)+"\"/>\n"+
+" </td>\n"+
+" </tr>\n"+
+" <tr>\n"+
" <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"SolrConnector.ModifiedDateFieldName") + "</nobr></td>\n"+
" <td class=\"value\">\n"+
" <input name=\"modifieddatefield\" type=\"text\" size=\"32\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(modifiedDateField)+"\"/>\n"+
@@ -1526,6 +1542,7 @@ public class SolrConnector extends org.a
{
out.print(
"<input type=\"hidden\" name=\"idfield\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(idField)+"\"/>\n"+
+"<input type=\"hidden\" name=\"originalsizefield\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(originalSizeField)+"\"/>\n"+
"<input type=\"hidden\" name=\"modifieddatefield\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(modifiedDateField)+"\"/>\n"+
"<input type=\"hidden\" name=\"createddatefield\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(createdDateField)+"\"/>\n"+
"<input type=\"hidden\" name=\"indexeddatefield\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(indexedDateField)+"\"/>\n"+
@@ -1814,6 +1831,10 @@ public class SolrConnector extends org.a
if (idField != null)
parameters.setParameter(SolrConfig.PARAM_IDFIELD,idField);
+ String originalSizeField = variableContext.getParameter("originalsizefield");
+ if (originalSizeField != null)
+ parameters.setParameter(SolrConfig.PARAM_ORIGINALSIZEFIELD,originalSizeField);
+
String modifiedDateField = variableContext.getParameter("modifieddatefield");
if (modifiedDateField != null)
parameters.setParameter(SolrConfig.PARAM_MODIFIEDDATEFIELD,modifiedDateField);
@@ -2254,6 +2275,14 @@ public class SolrConnector extends org.a
}
else
sb.append('-');
+
+ if (originalSizeAttributeName != null)
+ {
+ sb.append('+');
+ pack(sb,originalSizeAttributeName,'+');
+ }
+ else
+ sb.append('-');
if (modifiedDateAttributeName != null)
{
Modified: manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_en_US.properties?rev=1682231&r1=1682230&r2=1682231&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_en_US.properties (original)
+++ manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_en_US.properties Thu May 28 12:32:40 2015
@@ -53,6 +53,7 @@ SolrConnector.Add=Add
SolrConnector.AddZookeeperHost=Add ZooKeeper host
SolrConnector.Certificate=Certificate:
SolrConnector.IDFieldName=ID field name:
+SolrConnector.OriginalSizeFieldName=Original size field name:
SolrConnector.ModifiedDateFieldName=Modified date field name:
SolrConnector.CreatedDateFieldName=Created date field name:
SolrConnector.IndexedDateFieldName=Indexed date field name:
Modified: manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_ja_JP.properties?rev=1682231&r1=1682230&r2=1682231&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_ja_JP.properties (original)
+++ manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_ja_JP.properties Thu May 28 12:32:40 2015
@@ -53,6 +53,7 @@ SolrConnector.Add=追å
SolrConnector.AddZookeeperHost=ZooKeeperãã¹ãã追å
SolrConnector.Certificate=証æ証ï¼
SolrConnector.IDFieldName=IDãã£ã¼ã«ãåï¼
+SolrConnector.OriginalSizeFieldName=Original size field name:
SolrConnector.ModifiedDateFieldName=æ´æ°æ¥ä»ãã£ã¼ã«ãåï¼
SolrConnector.CreatedDateFieldName=ä½ææ¥ä»ãã£ã¼ã«ãåï¼
SolrConnector.IndexedDateFieldName=Indexed date field name:
Modified: manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_zh_CN.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_zh_CN.properties?rev=1682231&r1=1682230&r2=1682231&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_zh_CN.properties (original)
+++ manifoldcf/branches/CONNECTORS-1204/connectors/solr/connector/src/main/native2ascii/org/apache/manifoldcf/agents/output/solr/common_zh_CN.properties Thu May 28 12:32:40 2015
@@ -53,6 +53,7 @@ SolrConnector.Add=æ·»å
SolrConnector.AddZookeeperHost=æ·»å ZooKeeper主æº
SolrConnector.Certificate=è¯ä¹¦:
SolrConnector.IDFieldName=IDå段å:
+SolrConnector.OriginalSizeFieldName=Original size field name:
SolrConnector.ModifiedDateFieldName=æ´æ°æ¥æå段å:
SolrConnector.CreatedDateFieldName=çææ¥æå段å:
SolrConnector.IndexedDateFieldName=ç´¢å¼åçæ¥æå段å: