Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何让SimpleLucene.Net与Azure协同工作_C#_Asp.net_.net_Lucene_Lucene.net - Fatal编程技术网

C# 如何让SimpleLucene.Net与Azure协同工作

C# 如何让SimpleLucene.Net与Azure协同工作,c#,asp.net,.net,lucene,lucene.net,C#,Asp.net,.net,Lucene,Lucene.net,我们在整个应用程序中使用SimpleLucene进行搜索。一切正常。我们将我们的应用程序上传到azure,它工作正常,但是,每次我做任何更改,并且必须重新上传到azure,我必须重新创建索引以确保它是最新的。我想将我的Azure索引移动到Azure上的Blob存储,但是我不知道如何让Azure Lucene目录与SimpleLucene一起工作。样本代码将不胜感激 我正在建立这样的索引 var path = @"my path to the index"; var indexWriter = n

我们在整个应用程序中使用SimpleLucene进行搜索。一切正常。我们将我们的应用程序上传到azure,它工作正常,但是,每次我做任何更改,并且必须重新上传到azure,我必须重新创建索引以确保它是最新的。我想将我的Azure索引移动到Azure上的Blob存储,但是我不知道如何让Azure Lucene目录与SimpleLucene一起工作。样本代码将不胜感激

我正在建立这样的索引

var path = @"my path to the index";
var indexWriter = new SimpleLucene.Impl.DirectoryIndexWriter(new System.IO.DirectoryInfo(path), true);
var definitions = GetDefinitions().ToList();

using (var indexService = new SimpleLucene.Impl.IndexService(indexWriter))
{
     try
     {
         indexService.IndexEntities(definitions, new DefinitionsIndexDefinition());
     }
     catch { }
}

如何从Azure blob存储创建indexWriter?我知道我可以使用AzureDirectory dll,但它不能与SimpleLucene一起使用。我想说,SimpleLucene可能不是与Windows Azure一起使用的好选项,因为我不确定它是否有代码将索引存储在Windows Azure Blob存储上。您确定它可以保存到Windows Azure Blob存储上的索引吗

我已经使用了,您可以通过设置Azure Blob存储直接使用它在Windows Azure Blob存储上存储索引

<configuration>
  <appSettings>
    <!-- azure SETTINGS -->
    <add key="BlobStorageEndpoint" value="http://YOURACCOUNT.blob.core.windows.net"/>
    <add key="AccountName" value="YOURACCOUNTNAME"/>
    <add key="AccountSharedKey" value="YOURACCOUNTKEY"/>
  </appSettings>
</configuration>
步骤1:配置Azure Blob存储

<configuration>
  <appSettings>
    <!-- azure SETTINGS -->
    <add key="BlobStorageEndpoint" value="http://YOURACCOUNT.blob.core.windows.net"/>
    <add key="AccountName" value="YOURACCOUNTNAME"/>
    <add key="AccountSharedKey" value="YOURACCOUNTKEY"/>
  </appSettings>
</configuration>

因此,如果您决定在Windows Azure上使用Lucene.net,这将是相对简单和最好的做法。

这可能有助于@Blam-我有这个库,但我无法让它与我已有的SimpleReceneth代码一起工作。我不得不修改SimpleLucene的实现,以使其正常工作。我认为它是可行的,需要做更多的测试。SimpleLucene是Lucene.NET上的一个很好的包装器,它在codeplex上有3次下载,只是因为你不是真的从那里下载的,你是从NuGet获得的,而它有995次下载。明白了。。谢谢你的信息。我甚至从未尝试过使用它。也许你可以先让Lucene.Net工作,然后尝试使用SimpleLucene,这可能会帮助你开始工作。祝你好运