Uploaded image for project: 'Lucene.Net'
  1. Lucene.Net
  2. LUCENENET-169

Changes to make Lucene.NET compatible with ASP.NET Medium Trust Level, in hosting environments (like GoDaddy...)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      ASP.NET

      Description

      Microsoft has a configuration file for shared hosting for what they call "Medium Trust". There are a couple places in FSDirectory.cs that violate the restrictions of Medium Trust, but I coded workarounds, shown below.

      #1)

      // Corey Trager, Oct 2008: Commented call to GetTempPath to workaround permission restrictions at shared host.
      // LOCK_DIR isn't used anyway.
      public static readonly System.String LOCK_DIR = null; // SupportClass.AppSettings.Get("Lucene.Net.lockDir", System.IO.Path.GetTempPath());

      #2)

      /// <summary>Returns an array of strings, one for each Lucene index file in the directory. </summary>
      public override System.String[] List()
      {

      /* Changes by Corey Trager, Oct 2008, to workaround permission restrictions at shared host */
      System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(directory.FullName);
      System.IO.FileInfo[] files = dir.GetFiles();
      string[] list = new string[files.Length];
      for (int i = 0; i < files.Length; i++)

      { list[i] = files[i].Name; }

      return list;
      /* end of changes */

      // System.String[] files = SupportClass.FileSupport.GetLuceneIndexFiles(directory.FullName, IndexFileNameFilter.GetFilter());
      // for (int i = 0; i < files.Length; i++)
      //

      { // System.IO.FileInfo fi = new System.IO.FileInfo(files[i]); // files[i] = fi.Name; // }

      // return files;
      }

        Attachments

        1. FSDirectory.patch
          0.9 kB
          Digy
        2. FSDirectory-mediumtrust.patch
          0.6 kB
          Martijn Boland
        3. FSDirectory.patch
          0.7 kB
          Digy

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ctrager Corey Trager
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: