Giter Club home page Giter Club logo

luceneclouddirectory's Introduction

LuceneCloudDirectory

This project is a Lucene.net Directory provider that stores the content on a cloud provider and caches content in a local directory. You use the CachedDirectory as you would Lucene's FSDirectory. This project is a fork of AzureDirectory with support for other cloud providers.

Supported Cloud Providers:

  • Azure
  • Amazon

There is also a CachedFolderProvider that allows you to flex the CachedDirectory without needing to sign up for an account on one of these cloud providers.

Example Use

Open up any of the Test projects to see it in use.

  1. Install Lucene.net NuGet package

  2. Reference the built output from your chosen cloud provider project (e.g. /AmazonDirectory/bin/Debug/Lucene.Net.Store.Cloud.Amazon.dll)

  3. Instantiate the CloudProvider (e.g. AmazonCloudProvider)

     string amazonKey = ConfigurationManager.AppSettings["AmazonKey"];
     string amazonSecret = ConfigurationManager.AppSettings["AmazonSecret"];
     string bucket = ConfigurationManager.AppSettings["AmazonBucket"];
     string region = ConfigurationManager.AppSettings["AmazonRegion"];
     
     ICloudProvider provider = new AmazonCloudProvider( amazonKey, amazonSecret, bucket, region );
    
  4. Instantiate the CachedDirectory

     using (CachedDirectory cachedDirectory = new CachedDirectory(provider)) {
    
  5. Use Lucene.net as you normally would

     	using (StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_30)) {
     		using (IndexWriter indexWriter = GetIndexWriter(cachedDirectory, analyzer)) {
     			Document doc = new Document();
     			doc.Add(new Field("id", DateTime.Now.ToFileTimeUtc().ToString(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));
     			doc.Add(new Field("Title", "the title", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));
     			doc.Add(new Field("Body", "this is a document body", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));
     			indexWriter.AddDocument(doc);
     		}
     	}
    
     	using (IndexSearcher searcher = new IndexSearcher(cachedDirectory)) {
     		SearchForPhrase(searcher, "title");
     		SearchForPhrase(searcher, "body");
     	}
     }
    

License

AzureDirectory is released as MS-PL Lucene.net is released as Apache 2.0 This project is released as Apache 2.0

luceneclouddirectory's People

Contributors

jcspader avatar robrich avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.