On Wed, 23 Jan 2008, John Mendenhall wrote:

> I am using nutch-0.9.
> 
> In the searcher.IndexSearcher class, there is a getDirectory
> method that uses the following two calls:
> 
> -----
>     if ("local".equals(this.fs.getName())) {
>       return FSDirectory.getDirectory(file.toString(), false);
>     ....
> -----
> 
> I am getting a warning on the this.fs.getName()
> and FSDirectory.getDirectory() calls, stating these
> calls are deprecated.
> 
> I reviewed the documentation.  They are definitely
> deprecated.  What is the correct code to be used in
> this method?
> 
> For org.apache.hadoop.fs.FileSystem getName(), the
> documentation states we should use getUri().  However,
> this returns a URI.  How should I compare it with the
> static string "local"?
> 
> For org.apache.lucene.store.FSDirectory getDirectory(),
> the documentation states we should use IndexWriter's
> create flag to create an index.  However, since we are
> passing in false, can we just remove the boolean?
> 
> Please let me know how we are planning on modifying
> this code to adhere to the APIs we are using.

I am sorry for responding to my own message.
I just think I found a good way to do this, though
anyone can disagree if they want.

I made the following changes:

current nutch-0.9 code:
-----
        if ("local".equals(this.fs.getName())) {
            return FSDirectory.getDirectory(file.toString(), false);
-----

new code:
-----
        if ("local".equals(this.conf.get("fs.default.name"))) {
            return FSDirectory.getDirectory(file.toString());
-----

This compiles without deprecated warnings.
Please let me know if this is useful or breaks
anything.

Thanks!

JohnM

-- 
john mendenhall
[EMAIL PROTECTED]
surf utopia
internet services

Reply via email to