Alright, I’ve been trying to get this working for 2 days: I want to full text search on an Azure worker role. I think Lucene.NET is good for this. I’ve used this example: Use AzureDirectory with Lucene.NET 3.0.3.0.
I’m using the code below:
CloudStorageAccount cloudAccount = CloudStorageAccount.FromConfigurationSetting("CloudStorageSetting");
var cacheDirectory = new RAMDirectory();
AzureDirectory azureDirectory = new AzureDirectory(cloudAccount, "MyCloudIndex", cacheDirectory);
Analyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);
IndexWriter indexWriter = new IndexWriter(azureDirectory, analyzer, IndexWriter.MaxFieldLength.UNLIMITED);
With Lucene.Net 3.0.3.0 and Lucene.Net.Store.Azure 1.0.5.1, on Azure SDK 1.8. I also tried the older Lucene.NET (2.9.xxx) but that didn’t work either. I updated Windows.Azure.Storage: still doesn’t work.
The problem is: Visual Studio gives me an error that the azureDirectory that is inserted into IndexWriter needs to be of type Directory instead of AzureDirectory. When I change its type to Directory however, it says that AzureDirectory is not a subtype of Directory.
How come ALL the examples on the internet are wrong and don’t work when I literally copy paste them?
Update: the issue is fixed, I wrote a blog post about it: http://leoncullens.nl/post/2012/11/18/Full-Text-Search-on-Azure-with-LuceneNET.aspx
I have ‘forked’ this project, updated the Lucene reference to 3.0.3, and updated the Azure Storage client to 2.0 (the version that ships with v1.8 SDK), and placed the code here:
https://github.com/richorama/AzureDirectory
It should be relatively straight forward to copy the sample code in the ‘TestApp’ to figure out how to use this version of Lucene.NET.
*disclaimer, I am not a Lucene expert, and I haven’t tested this properly – use at your own risk!