Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Carrot and Lucene together

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11185
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic