Note that there are some explanatory texts on larger screens.

plurals
  1. POProper structuring of Lucene.Net usage in an ASP.NET MVC site
    primarykey
    data
    text
    <p>I'm building an ASP.NET MVC site where I plan to use Lucene.Net. I've envisioned a way to structure the usage of Lucene, but not sure whether my planned architecture is OK and efficient.</p> <hr> <h2>My Plan:</h2> <ul> <li>On <code>Application_Start</code> event in Global.asax: I check for the existence of the index on the file system - if it doesn't exist, I create it and fill it with documents extracted it from the database.</li> <li>When new content is submitted: I create an <code>IndexWriter</code>, fill up a document, write to the index, and finally dispose of the <code>IndexWriter</code>. <code>IndexWriters</code> are not reused, as I can't imagine a good way to do that in an ASP.NET MVC application.</li> <li>When content is edited: I repeat the same process as when new content is submitted, except that I first delete the old content and then add the edits.</li> <li>When a user searches for content: I check <code>HttpRuntime.Cache</code> to see if a user has already searched for this term in the last 5 minutes - if they have, I return those results; otherwise, I create an <code>IndexReader</code>, build and run a query, put the results in <code>HttpRuntime.Cache</code>, return them to the user, and finally dispose of the <code>IndexReader</code>. Once again, <code>IndexReaders</code> aren't reused.</li> </ul> <hr> <h2>My Questions:</h2> <ul> <li>Is that a good structure - <strong>how can I improve it?</strong></li> <li>Are there <strong>any performance/efficiency problems</strong> I should be aware of?</li> <li>Also, is <strong>not reusing the IndexReaders and IndexWriters</strong> a huge code smell?</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload