HelpFileDocument.java (d127360f) HelpFileDocument.java (7fb4469b)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 49 unchanged lines hidden (view full) ---

58 Document doc = new Document();
59
60 // Add the path of the file as a field named "path". Use a field that is
61 // indexed (i.e. searchable), but don't tokenize the field into words.
62 File aFile = aCaptionFile != null ? aCaptionFile : aContentFile;
63 if( aFile != null )
64 {
65 String aPath = "#HLP#" + aModule + "/" + aFile.getName();
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 49 unchanged lines hidden (view full) ---

58 Document doc = new Document();
59
60 // Add the path of the file as a field named "path". Use a field that is
61 // indexed (i.e. searchable), but don't tokenize the field into words.
62 File aFile = aCaptionFile != null ? aCaptionFile : aContentFile;
63 if( aFile != null )
64 {
65 String aPath = "#HLP#" + aModule + "/" + aFile.getName();
66 doc.add(new Field("path", aPath, Field.Store.YES, Field.Index.UN_TOKENIZED));
66 doc.add(new Field("path", aPath, Field.Store.YES, Field.Index.NOT_ANALYZED));
67 }
68
69 // Add the caption of the file to a field named "caption". Specify a Reader,
70 // so that the text of the file is tokenized and indexed, but not stored.
71 doc.add( new Field( "caption", getReaderForFile( aCaptionFile ) ) );
72
73 // Add the contents of the file to a field named "content". Specify a Reader,
74 // so that the text of the file is tokenized and indexed, but not stored.
75 doc.add( new Field( "content", getReaderForFile( aContentFile ) ) );
76
77 // return the document
78 return doc;
79 }
80
81 private HelpFileDocument() {}
82}
67 }
68
69 // Add the caption of the file to a field named "caption". Specify a Reader,
70 // so that the text of the file is tokenized and indexed, but not stored.
71 doc.add( new Field( "caption", getReaderForFile( aCaptionFile ) ) );
72
73 // Add the contents of the file to a field named "content". Specify a Reader,
74 // so that the text of the file is tokenized and indexed, but not stored.
75 doc.add( new Field( "content", getReaderForFile( aContentFile ) ) );
76
77 // return the document
78 return doc;
79 }
80
81 private HelpFileDocument() {}
82}