lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mil84 <mi...@centrum.sk>
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,
Field.Index.TOKENIZED));
doc.add(new Field("Creator", "John Smith", Field.Store.YES,
Field.Index.TOKENIZED));
doc.add(new Field("Title", "hohoho", Field.Store.YES,
Field.Index.TOKENIZED));

2) Searching in contents - it WORKS OK

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

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 = is.search(q); 


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


-- 
View this message in context: http://www.nabble.com/How-to-search-in-metadata--%28filename%2C-document-title%2C-cocument-creator%2C-...%29-tp20069124p20073802.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message