summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultFileDocumentProcessor.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultFileDocumentProcessor.java99
1 files changed, 50 insertions, 49 deletions
diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultFileDocumentProcessor.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultFileDocumentProcessor.java
index 0411e7d875..e997b8f1f2 100644
--- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultFileDocumentProcessor.java
+++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultFileDocumentProcessor.java
@@ -33,54 +33,55 @@ import org.apache.tuscany.sca.domain.search.DocumentProcessor;
*/
public class DefaultFileDocumentProcessor implements DocumentProcessor {
- public Document process(DocumentProcessor parentProcessor,
- DocumentMap documents, Object object, Document doc, String parent) {
-
- if (object instanceof FileContent) {
- FileContent file = (FileContent) object;
-
- Reader reader;
- try {
- reader = new InputStreamReader(file.getInputStream());
-
- if (doc == null) {
- doc = documents.get(file.getPath());
- }
-
- doc.add(new Field(SearchFields.FILE_CONTENT_FIELD, reader));
-
- doc.add(new Field(SearchFields.FILE_CONTENT_FIELD,
- "", Field.Store.YES,
- Field.Index.ANALYZED));
-
- return doc;
-
- } catch (IOException e) {
- // ignore the file
- }
-
- }
-
- return null;
-
- }
-
- public Object getDocumentKey(Object object) {
-
- if (object instanceof File) {
- File file = (File) object;
- String path = file.getPath();
-
- if (path != null && path.length() == 0) {
- return null;
- }
-
- return path;
-
- }
-
- throw new IllegalArgumentException();
-
- }
+ public Document process(DocumentProcessor parentProcessor,
+ DocumentMap documents,
+ Object object,
+ Document doc,
+ String parent) {
+
+ if (object instanceof FileContent) {
+ FileContent file = (FileContent)object;
+
+ Reader reader;
+ try {
+ reader = new InputStreamReader(file.getInputStream());
+
+ if (doc == null) {
+ doc = documents.get(file.getPath());
+ }
+
+ doc.add(new Field(SearchFields.FILE_CONTENT_FIELD, reader));
+
+ doc.add(new Field(SearchFields.FILE_CONTENT_FIELD, "", Field.Store.YES, Field.Index.ANALYZED));
+
+ return doc;
+
+ } catch (IOException e) {
+ // ignore the file
+ }
+
+ }
+
+ return null;
+
+ }
+
+ public Object getDocumentKey(Object object) {
+
+ if (object instanceof File) {
+ File file = (File)object;
+ String path = file.getPath();
+
+ if (path != null && path.length() == 0) {
+ return null;
+ }
+
+ return path;
+
+ }
+
+ throw new IllegalArgumentException();
+
+ }
}