I want to search all the documents for a string. So I have the following. But Hits isn't returning anything. What am I doing wrong? Thanks in advance.
File f = new File("AddressData.txt"); IndexWriter writer; try { writer = new IndexWriter("C:\\", new StandardAnalyzer(), true); FileInputStream fstream = new FileInputStream("AddressData.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { Document doc = new Document(); doc.add(new Field("filename", f.getCanonicalPath(), Field.Store.YES, Field.Index.TOKENIZED)); doc.add(new Field("line", strLine, Field.Store.YES, Field.Index.TOKENIZED)); writer.addDocument(doc); } in.close(); writer.close(); IndexSearcher iSearch = new IndexSearcher("C:\\"); Term term = new Term("line", "KOREA"); PhraseQuery query = new PhraseQuery(); query.add(term); Hits hits = iSearch.search(query); } } catch (CorruptIndexException e) { e.printStackTrace(); } catch (LockObtainFailedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } --- Brittany --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]