Re-directing this message to lucene-user list.

That is the correct behaviour.
Use
http://jakarta.apache.org/lucene/docs/api/org/apache/lucene/document/Field.html#Text(java.lang.String,%20java.lang.String)
if you want to be able to retrieve the original value of the indexed
text.

Otis

--- jitender ahuja <[EMAIL PROTECTED]> wrote:
> I am working to make an index using Lucene over HTML files. I intend
> to use the Reader as the type of the text field so as to not store
> the Html files verbatim in the index. But the data retrieval yields
> null as the text retrieved.
> 
> However, if I do not use the Reader class as the Text field type,
> then I get whole file back .Also, the index directory size is nearly
> four times more now.
> 
> <br><br>
> 
> The indexer code that deals with the Reader data type is:
> 
> <br>
> 
> <p> public class IndexData{
> 
> <p> protected static final String INDEX_FOLDER = "C:\\Temp\\DB_GT11";
> 
> <pre>public static void main(String[] args)
> 
>       {
> 
>         try{
> 
>               IndexData objDBdex = new IndexData();
> 
>               boolean createDex = !objDBdex.indexExists();
> 
> </pre>
> 
>      <p>IndexWriter writ = new IndexWriter(INDEX_FOLDER, new
> StandardAnalyzer(), createDex);
> 
> <pre>
> 
>          for(int i=0; i<args.length; i++){
> 
>         System.out.println("Indexing File" +args[i]);
> 
>         InputStream is = new FileInputStream(args[i]);
> 
>         Document doc = new Document();
> 
>        doc.add(Field.UnIndexed("path", args[i]));</pre>
> 
>       <p> BufferedReader rdr = new BufferedReader((Reader)new
> InputStreamReader(is));
> 
> <pre>
> 
>       StringBuffer fileBuffer = new StringBuffer();
> 
>      String line;
> 
>      while ((line = rdr.readLine()) != null ) {
> 
>     fileBuffer.append(line);
> 
>    }
> 
>       System.out.println("File contents from buffer: ");
> 
>       System.out.println(fileBuffer.toString());
> 
>       StringReader ab = new StringReader(fileBuffer.toString());
> 
>       doc.add(Field.Text("body", (Reader)ab));
> 
>       writ.addDocument(doc);
> 
>       is.close();
> 
>     }
> 
>      writ.close();
> 
>     }
> 
>      catch(IOException ex) {
> 
>              ex.printStackTrace();
> 
>      }
> 
>   }
> 
>    public boolean indexExists(){
> 
>         return false;
> 
>     }
> 
>   }
> 
> </pre>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to