Hi All
 
I am indexing a document like this...
 
Document doc = new Document();
  doc.add(Field.Text("contents", new FileReader(f)));
  doc.add(Field.Text("filename",f.getCanonicalPath()));
  Iterator it = fields.keySet().iterator();
  String element = "";
     while (it.hasNext()) {
        element =  (String)it.next();
        doc.add(Field.Text(element,(String)fields.get(element)));  // also 
tried field.keyword
     }
     writer.addDocument(doc);
     writer.optimize();
     writer.close();
 
So the lucene doc has the text of the uploaded doc and also some params like 
author, date, etc.
 
When I write my search 

String queryStr = request.getParameter("query");

File indexDir = new File("c:/luceneindex");

Directory fsDir = FSDirectory.getDirectory(indexDir,false);

IndexSearcher is = new IndexSearcher(fsDir);

Query query = QueryParser.parse(queryStr,"contents", new StandardAnalyzer());

Hits hits = is.search(query);

Not surprisingly I get a match only if there is a word in the contents of the 
document.

Question: If my query should be able to search not only document contents but 
also the other data added such as author how do I do that.

Please let me know.

Also if I can get a pointer this type of info I will really appreciate it.

Thanks

bib/-


                
---------------------------------
Yahoo! Mail
 Stay connected, organized, and protected. Take the tour

Reply via email to