Question

I download AzureDirectory and with latest Lucene.NET Simply cannot compile

Lots of error like

'Lucene.Net.Store.Azure.AzureDirectory' does not implement inherited abstract member 'Lucene.Net.Store.Directory.Dispose(bool)'

Is there any new AzureDirectory that can work with the Lucene 3?

Was it helpful?

Solution

I have tested the Lucene.Net.Store.Azure 1.0.5.1 with Lucene.Net 3.0.3 which worked for me. I used the following steps so you can try as well:

  1. Created a Windows Azure Worker Role in VS2010
  2. Included Lucene.NET.Store.Azure (1.0.5.1) from here (which has dependency on Lunece.NET 2.9.4.1 and above) using VS Package Manager

    2.1 PM> Install-Package Lucene.Net.Store.Azure

  3. After that I updated Lucene.net to 3.0.3 RC from here which removed Lucene.net 2.9.4.1 and installed 3.0.3 bits

    3.1 PM> Install-Package Lucene.Net -Pre

  4. Verified that I have latest bits and all the dependency set in my project, I added the following test code in my worker role:

    Lucene.Net.Util.Version version = Lucene.Net.Util.Version.LUCENE_30;
    Microsoft.WindowsAzure.CloudStorageAccount cloudAccount = Microsoft.WindowsAzure.CloudStorageAccount.FromConfigurationSetting("CloudStorageSetting");
    var cacheDirectory = new RAMDirectory();
    AzureDirectory azureDirectory = new AzureDirectory(cloudAccount, "MyCloudIndex",cacheDirectory);
    IndexWriter indexWriter = null;
    Analyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);
    indexWriter = new IndexWriter(azureDirectory, analyzer, IndexWriter.MaxFieldLength.UNLIMITED); 
    Document doc = new Document();
    indexWriter.AddDocument(doc);
    indexWriter.Dispose();
    azureDirectory.Dispose();
    

The was no compilation error and the role did work fine so you can try the same and see.

OTHER TIPS

I have just downloaded AzureDirectory 1.0.5.1 from Nuget and decompiled it with JustDecompile. The AzureDirectory class does not implement several abstract members from the Directory class in Lucene.net 3.0.3 (release version), such as ListAll(). Therefore, AzureDirectory 1.0.5.1 cannot be compatible with Lucene.net 3.0.3

Hopefully the authors will upgrade AzureDirectory to support this new version of Lucene.net soon. In the meantime I suggest delving into the code yourself... this is what I'm doing. Although not sure whether I'll be successful as I'm not au-fait with the internal workings of Lucene.

Thanks for your help everyone, I have got AzureDirectory with Lucene 3.0.3.0 and latest Azure SDK.

I have a question though. I have 4 unique Lucene Index, basically different products for different countries. "lucenedb-us", "lucenedb-au", "lucenedb-eu", etc.

How exactly does the AzureDirectory caching work?

Will this:

azureDirectory = new AzureDirectory(cloudStorageAccount, "lucenedb-us", new RAMDirectory());

and then that:

azureDirectory = new AzureDirectory(cloudStorageAccount, "lucenedb-au", new RAMDirectory());

result in accurate results, or will the code always use "lucenedb-us"? If it will always use "lucenedb-us", will removing new RAMDirectory() fix the problem?

You can use this GitHub repository: https://github.com/richorama/AzureDirectory
You have to build it yourself but it works as expected with Lucene 3.0.3 and Azure Tools 2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top