Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:52:53+00:00 2026-06-17T15:52:53+00:00

I have inherited some code that uses Simple Lucene. I know very little about

  • 0

I have inherited some code that uses Simple Lucene. I know very little about Simple Lucene. Right now, the code relies on the IndexService to index entities. The following code is used:

using (var indexService = GetIndexService())
{
  indexService.IndexEntities(cachedResults, p =>
  {
    var document = new Document();
    document.Add(new Field("Name", p.Name, Field.Store.YES, Field.Index.NOT_ANALYZED));
    document.Add(new Field("ID", p.ID, Field.Store.YES, Field.Index.NOT_ANALYZED));
    document.Add(new Field("Description", p.Description, Field.Store.YES, Field.Index.NOT_ANALYZED));
    return document;
  });
}

GetIndexService returns a SimpleLucene.Impl.DirectorySerivce instance. This approach was used to store the index on a local machine. However, now I need to move this to a Windows Azure Storage blob. In an attempt to do that, I’m relying on the library found at: https://github.com/richorama/AzureDirectory.

The example shown here returns a Lucene.Net.Index.IndexWriter. I have no idea how to use this object with the approach that’s there. The types seem entirely incompatible. All I wanted to do was use a different storage location for the index files. Is there a way to do this? If so, how. I’m completely up a creek here. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:52:54+00:00Added an answer on June 17, 2026 at 3:52 pm

    It appears that IndexEntities looks like this:

    public int IndexEntities<TEntity>(DirectoryInfo indexLocation, IEnumerable<TEntity> entities, Func<TEntity, Document> converter)
    {
        using (var indexer = new IndexWriterWrapper(indexLocation)) {
            int indexCount = 0;
            foreach (TEntity entity in entities) {
                indexer.Writer.AddDocument(converter(entity));
                indexCount++;
            }
            return indexCount;
        }
    }
    

    Basically, it opens an IndexWriter, iterates through a list of entities, converts them to documents, and adds them to the index through the writer, and returns a count.

    You indicate that you are returned an IndexWriter from the package, so you don’t need to worry about creating one. You are creating a document, so no mapping is necessary (the converter could make some changes to a document passed in, I suppose, but probably not), and you are just making one, so iterating or counting aren’t really nercessary. All that’s left is adding the Document, through IndexWriter.addDocument(Document)

    var writer = //However you get the writer...
    var document = new Document();
    document.Add(new Field("Name", p.Name, Field.Store.YES, Field.Index.NOT_ANALYZED));
    document.Add(new Field("ID", p.ID, Field.Store.YES, Field.Index.NOT_ANALYZED));
    document.Add(new Field("Description", p.Description, Field.Store.YES, Field.Index.NOT_ANALYZED));
    writer.addDocument(document);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited a bit of Java code that uses Hibernate. Some of the
I have inherited some code that uses regular expressions to parse CSV formatted data.
I have inherited some code that uses klass instead of PyDev's preferred cls: def
I have some inherited code that uses hibernate. I'm getting the following error: Caused
I have some inherited JS code that uses this format: function main(param) { var
I have inherited some code that uses the ref keyword extensively and unnecessarily. The
I've inherited some code that uses the sqlsrv_connect method to instantiate a connection to
I have some existing code that uses a std::ostringstream as an temporary buffer. To
I have some Java code that I 'inherited' from a previous co-worker. Part of
I have some code that uses JavaScript templates to create some HTML, including some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.