I hope you will forgive the newbie question but do I have to add the MoreLikeThis.class file to the Lucene-1.4.3.JAR for it to work?
I put the .class file in my \wwwroot\web-inf\classes folder and I am getting an error I don't understand when trying to instantiate the object from Cold Fusion. I also added the .class to a .jar and put it in \lib to no avail. I don't know if this is a CF problem or a Java problem. CF Error: Object Instantiation Exception. An exception occurred when instantiating a java object. The cause of this exception was that: MoreLikeThis (wrong name: org/apache/lucene/search/similar/MoreLikeThis). <cfscript> index="\\www\lucene\myindex"; // get an IndexReader object to use in the constructor to the searcher var indexReader = CreateObject("java", "org.apache.lucene.index.IndexReader"); // get an IndexSearcher object searcher = CreateObject("java", "org.apache.lucene.search.IndexSearcher"); searcher = searcher.init(indexReader.open(index)); // get an Analyzer object analyzer = CreateObject("java", "org.apache.lucene.analysis.standard.StandardAnalyzer"); analyzer.init(); mlt = CreateObject("java", "MoreLikeThis"); // <---- this is the line that causes the error mlt=mlt.init(indexReader); // [ I have also tried mlt = CreateObject("java", "org.apache.lucene.search.similar.MoreLikeThis");] target = "test of the similarity feature"; query = mlt.like( target); hits = CreateObject("java", "org.apache.lucene.search.Hits"); hits = searcher.search(query); </cfscript> -----Original Message----- From: Erik Hatcher [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 19, 2005 10:59 AM To: java-user@lucene.apache.org Subject: Re: Searching for similar documents On Jul 19, 2005, at 12:42 PM, Kadlabalu, Hareesh wrote: > If someone could someone please extract a version of this file from > source control that corresponds to lucene 1.4.3 or if this can file > can be back-ported, it would be greatly helpful. The old Jakarta Lucene Sandbox is still available via CVS: cvs -d:pserver:[EMAIL PROTECTED]:/home/cvspublic co jakarta- lucene-sandbox > 1. > IndexReader.getFieldNames( IndexReader.FieldOption.INDEXED ) does not > compile on 1.4.3, replace with IndexReader.getIndexedFieldNames ( true > )? I think you want false, not true. The boolean flag refers to term vector data. > 2. > query.add(tq, BooleanClause.Occur.SHOULD) does not compile on 1.4.3, > is this the same as query.add( tq, true, true )? No. It's the same as add(tq, false, false) > I have one small request, is it possible to make the archive of > 'Contribution' section that corresponds to Lucene > 1.4.3 release available online? At this point we're probably too far removed from it to accomplish that cleanly. MoreLikeThis may not have ever been 1.4.3 compatible - I don't recall - it certainly wasn't added until well after 1.4.3 was released. The CVS repository should be sufficient for folks to build it themselves if necessary. For most of the old Sandbox contributions, you can find binary releases of those in the Lucene in Action code distribution at www.lucenebook.com Erik --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]