lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mil84 <>
Subject Re: How to search in metadata? (filename, document title, cocument creator, ...)
Date Mon, 20 Oct 2008 16:41:50 GMT

Ok, better example. For example I want to search pdf file.

1) Indexing:

Document doc = LucenePDFDocument.getDocument(f);
doc.add(new Field("contents", new FileReader(f)));
doc.add(new Field("filename", "Example.pdf", Field.Store.YES,
doc.add(new Field("Creator", "John Smith", Field.Store.YES,
doc.add(new Field("Title", "hohoho", Field.Store.YES,

2) Searching in contents - it WORKS OK

QueryParser parser = new QueryParser("contents", new StandardAnalyzer());
Query q = parser.parse(searchText);
Hits hits =; 

3) Searching in title - it DON'T WORK (I try to find hohoho, and nothing).
Same with searching in creator, etc...

QueryParser parser = new QueryParser("title", new StandardAnalyzer());
Query q = parser.parse(searchText);
Hits hits =; 

I simple can't understand, where I made mistake? It's simple code...

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message