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 8405727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:54:35+00:00 2026-06-09T22:54:35+00:00

Reading up on Lucene, it seems it’s recommeneded to use the same instance of

  • 0

Reading up on Lucene, it seems it’s recommeneded to use the same instance of IndexSearcher across all requests.

If I have a search class which is injected using ninject

public interface IPatientSearch
{
    void DoSearch(ref SearchDTO _search);

    //...
}

Would there be any issues binding it using InSingletonScope, which would ensure the same instance is shared across all requests?

        Bind<IPatientSearch>().To<PatientSearch>().InSingletonScope();

Am I missing any obvious pitfalls of using such an approach?

  • 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-09T22:54:36+00:00Added an answer on June 9, 2026 at 10:54 pm

    There’s not an issue here from the Lucene.NET point of view; assuming your implementation of IPatientSearch creates an IndexWriter and uses that, there shouldn’t be any problem. The IndexWriter class is thread-safe, and you won’t have any troubles accessing your Lucene.NET index.

    However, you have to make sure that all other aspects of the IPatientSearch implementation are thread-safe; if this singleton is accessed from multiple threads, then any other state that you have in the implementation has to be thread-safe. If your class is just a pass-through for calls to Lucene.NET, then you’ll be fine, but if you have other state, then you need to make sure access to that state is synchronized.

    You might want to create a thin abstraction around Lucene.NET and make that a singleton for the purposes of dependency injection, and have your other classes be instantiated normally (unless you need only one instance of that class).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started reading up on Lucene. In one of the examples provided,
I have been reading the new 2nd edition of the Lucene in Action and
I am looking into using Lucene.NET after reading some bad reviews of SQL Server's
Reading the docs, I'd expect $(#wrap2).remove(.error) to remove all .error elements from #wrap2 .
Reading across difference lineage of CPU created by intel , many questions aroused in
I have a table I want to run a fulltext search on, but it
I want to store the results of reading lucene index into jTable, so that
Reading source code of my current project, I see: [self retain] in one class,
Reading through the CKEditor documentation , I see that they have an option to
Reading this site, I've found this : [The] line private static final Foo INSTANCE

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.