java - How to return an object with lucene? -
i've been following tutorial on lucene. instead of:
private static void adddoc(indexwriter w, string title, string isbn) throws ioexception { document doc = new document(); doc.add(new textfield("title", title, field.store.yes)); // use string field isbn because don't want tokenized doc.add(new stringfield("isbn", isbn, field.store.yes)); w.adddocument(doc); } i pass object of own class called car along it's instance variables
private static void adddoc(indexwriter w, car thiscar, string name, string brand) throws ioexception { document doc = new document(); doc.add(new textfield("name", name, field.store.yes)); doc.add(new stringfield("brand", brand, field.store.yes)); w.adddocument(doc);} is there way can search name , brand , have lucene return car object instead of individual string variables? i've looked through docs document class in lucene can't seem find anything.
Comments
Post a Comment