aspose file tools*
The moose likes Java in General and the fly likes Carrot and Lucene together Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Carrot and Lucene together" Watch "Carrot and Lucene together" New topic
Author

Carrot and Lucene together

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 743
Hi, I'm using the carrot api...

carrot2-java-api-3.4.0-dev (exanples and jars)

and the lucene api from lucene in action (code and jars)


When I put them into separate projects in elipse, I can execute:
1. org.carrot2.examples.clustering.ClusteringDocumentList (in carrot)
2. lia.meetlucene.Indexer & Searcher (in lucene)

without any problems.


Now, when I try and combine both into 1 project, I have a kind of clash...
lucene-1.4.3.jar (in lucene) contains the org.apache.lucene packages.

And lucene-core-3.0.1 also contains the org.apache.lucene packages.


So with the project as 1 project, the error is with the lia.meetlucene.Indexer class, which says:
"The constructor IndexWriter(File, StandardAnalyzer, boolean) is undefined.

I think it might be trying to use the class from the other package of the same name.
Its so frustrating, cause I need to use both, can any one help? And remember I'm a beginner with this, so I don't know whats going on that much.

Thanks

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

In such scenarios, you should use the following strategy


Also, instead of having a blanket import statement (import java.awt.*) have specific statements like import java.awt.List;


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Colin, I think Maneesh misunderstood your question; I don't think his answer is relevant at all, so don't worry if you don't see how to apply it.

The easiest thing to do would be to simply use the same version of Lucene that Carrot uses. Why are you trying to use the (very old) Lucene 1.4.3, when Carrot already comes with the (current, modern, perfectly lovely) Lucene 3.0 ?


[Jess in Action][AskingGoodQuestions]
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 743
Thanks. but I'm confused.

I need to use the class lia.meetlucene.Indexer and Searcher.
But these are in the lucene in action project(downloadable from their site).

So I don't think I can just use the Carrot on its own, although I know it has something to do with lucene in it.

So I'm not sure what to do, any thoughts?, thanks
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 743
I downloaded lucene-3.0.1.zip, which has IndexFiles and SearchFiles classes, I guess the same as the Indexer and Searcher in lucene for action.

I'll try it out and get back to you. Thanks
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Hmm. Well, "Lucene in Action" was published in 2004, and so the book's source code is based on a 6 year old version of Lucene -- apparently the API has changed during that time, which isn't a big surprise. I see that they're working on a second edition to be published very soon: Here's the link to the source code for the second edition, which I'm sure is far more up to date -- try using that!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
Yes, Lucene is one of the few projects/libraries that not just deprecates classes and methods, but actually removes them after a deprecation period (which generally is just one release long).

For example Lucene 3.0 is the same as 2.9 in functionality, minus all the deprecated stuff. The migration approach in this case would be to compile the source code against 2.9 with deprecation=true, and then address all issues reported until no more deprecation warnings are shown. Then the code will also compile against 3.0. The same was done earlier with Lucene 1.9/2.0.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Carrot and Lucene together
 
Similar Threads
Craig, one example please of a classic DO NOT DO THIS for application builds?
Class-Path reference is not working on EAR file.
My ui config dialog strategy + open ui questions
Exporting Code in Visual Age Java 3.5.3
hibernate lucene integration sample projects