lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mil84 <mi...@centrum.sk>
Subject How to search in metadata? (filename, document title, cocument creator, ...)
Date Mon, 20 Oct 2008 14:32:13 GMT

I've a problem witch searching. I need to search not only in file contents,
but also in metadata. But I don't know how to do it. My code:

Document doc = new Document();
doc.add(new Field("contents", new FileReader(f)));
writer.addDocument(doc);
...
QueryParser parser = new QueryParser("contents", new StandardAnalyzer());
Query q = parser.parse(list.get(i));
Hits hits = is.search(createQuery(searchText));

Everything is ok, it searches document's contents. But how to search for
example in filenames? I I add this:

doc.add(new Field("filename", f.getCanonicalPath(), Field.Store.YES,
Field.Index.UN_TOKENIZED));

it doesn't work. Same problem is searching in metadata...Anyone knows how to
do it? I browsed whole google 3 hours, but found nothing, not even just one
working example, simple nothing....Thanx a lot.
-- 
View this message in context: http://www.nabble.com/How-to-search-in-metadata--%28filename%2C-document-title%2C-cocument-creator%2C-...%29-tp20069124p20069124.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