[Yanel-commits] rev 44019 -
public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search
michi at wyona.com
michi at wyona.com
Wed Aug 5 16:17:35 CEST 2009
Author: michi
Date: 2009-08-05 16:17:35 +0200 (Wed, 05 Aug 2009)
New Revision: 44019
Modified:
public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java
Log:
use body content handler
Modified: public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java 2009-08-05 14:16:59 UTC (rev 44018)
+++ public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java 2009-08-05 14:17:35 UTC (rev 44019)
@@ -132,7 +132,6 @@
for (int i = 0; i < nodes.length; i++) {
// TODO: Check access policy if user is actually allowed to see this result
results[i] = new Result(nodes[i].getPath(), getTitle(nodes[i].getPath(), nodes[i].getInputStream(), nodes[i].getMimeType()), "TODO: excerpt", nodes[i].getMimeType(), null);
- //results[i] = new Result(nodes[i].getPath(), null, null, nodes[i].getMimeType(), null);
}
return results;
} else {
@@ -191,7 +190,10 @@
}
/**
- *
+ * Get title of node
+ * @param path Node path
+ * @param in Node content as InputStream
+ * @param mimeType Node content type
*/
private String getTitle(String path, InputStream in, String mimeType) throws Exception {
log.warn("DEBUG: Get title of node: " + path);
@@ -205,7 +207,8 @@
// NOTE: The tika meta data must not be null, hence we just declare something
org.apache.tika.metadata.Metadata tikaMetaData = new org.apache.tika.metadata.Metadata();
tikaMetaData.set("yarep:path", path);
- parser.parse(in, new org.apache.tika.sax.WriteOutContentHandler(writer), tikaMetaData);
+ parser.parse(in, new org.apache.tika.sax.BodyContentHandler(writer), tikaMetaData);
+ //parser.parse(in, new org.apache.tika.sax.WriteOutContentHandler(writer), tikaMetaData);
log.warn("DEBUG: Title: " + writer.toString());
} catch (Exception e) {
log.error(e, e);
More information about the Yanel-commits
mailing list