Lucene.Net
  1. Lucene.Net
  2. LUCENENET-465

Error indexing a document end Filed.Store.COMPRESS

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Cannot Reproduce
    • Affects Version/s: Lucene.Net 2.9.4
    • Fix Version/s: Lucene.Net 2.9.4
    • Component/s: .NET API
    • Labels:
    • Environment:

      Windows 7 x64 Professional, Visual Studio 2010 Ultimate SP1, .NET 4.0, Lucene.net 2.9.4.1, SharpZipLib 0.86.0.518

      Description

      I'm developing a index, and need to store values compressed, because its needed to show that info to the user.
      I've the current error: "Can not load ICSharpCode.SharpZipLib.dll", when I do the "writer.AddDocument(doc);"

      The DLLs are from NuGet.

      Snippet:
      //retirar o directório
      System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(path);
      //criar o directório para o lucene
      Directory directory = FSDirectory.Open(directoryInfo);
      //instanciar o analyser
      Analyzer analyzer = new SnowballAnalyzer("Portuguese");
      //abrir o indíce
      bool isNew = !IndexReader.IndexExists(directory);
      IndexWriter writer = new IndexWriter(directory, analyzer, isNew, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED);
      //gravar o documento
      Document doc = new Document();
      NumericField numericField = new NumericField("id", Field.Store.YES, false);
      numericField.SetIntValue(id);
      doc.Add(numericField);
      Field field = new Field("title", title, Field.Store.COMPRESS, Field.Index.ANALYZED);
      field.SetBoost(7);
      doc.Add(field);
      field = new Field("description", tescription, Field.Store.COMPRESS, Field.Index.ANALYZED);
      doc.Add(field);
      writer.AddDocument(doc);
      writer.Optimize();
      //Close the writer
      writer.Commit();
      writer.Close();
      }
      catch (Exception ex)

      { throw ex; }

        Activity

        Hide
        Christopher Currens added a comment -

        It looks by the issue description that you have SharpZipLib? Where is it in relation to the Lucene.NET dll? Can you print out the stack trace, exception type, and actual exception method?

        Show
        Christopher Currens added a comment - It looks by the issue description that you have SharpZipLib? Where is it in relation to the Lucene.NET dll? Can you print out the stack trace, exception type, and actual exception method?
        Hide
        João Rosa added a comment -

        Yes I have.
        The dll's are in folder packages (from nuget). Lucene is in subfolder Lucene.Net.2.9.4.1\lib\net40, and SharpZipLib is in subfolder SharpZipLib.0.86.0\lib\20.

        Error: Syste.IO.FileNotFoundException,

        {"Can not load ICSharpCode.SharpZipLib.dll":null}

        ;
        InnerException is null;
        Message "Can not load ICSharpCode.SharpZipLib.dll";
        StackTrace: at SupportClass.SharpZipLib.CreateDeflater()
        at Lucene.Net.Documents.CompressionTools.Compress(Byte[] value_Renamed, Int32 offset, Int32 length, Int32 compressionLevel)
        at Lucene.Net.Documents.CompressionTools.Compress(Byte[] value_Renamed, Int32 offset, Int32 length)
        at Lucene.Net.Index.FieldsWriter.WriteField(FieldInfo fi, Fieldable field)
        at Lucene.Net.Index.StoredFieldsWriterPerThread.AddField(Fieldable field, FieldInfo fieldInfo)
        at Lucene.Net.Index.DocFieldProcessorPerThread.ProcessDocument()
        at Lucene.Net.Index.DocumentsWriter.UpdateDocument(Document doc, Analyzer analyzer, Term delTerm)
        at Lucene.Net.Index.DocumentsWriter.AddDocument(Document doc, Analyzer analyzer)
        at Lucene.Net.Index.IndexWriter.AddDocument(Document doc, Analyzer analyzer)
        at Lucene.Net.Index.IndexWriter.AddDocument(Document doc)
        at Ideiota.Business.DAL.Services.SearchEngine.Indexer.IndexIdea(Idea idea, String path, Boolean indexInTemp) in D:\Projectos\Ideiota\Code\Ideiota\Ideiota.Business.DAL.Services\SearchEngine\Indexer.cs:line 75

        Thanks in advance

        Show
        João Rosa added a comment - Yes I have. The dll's are in folder packages (from nuget). Lucene is in subfolder Lucene.Net.2.9.4.1\lib\net40, and SharpZipLib is in subfolder SharpZipLib.0.86.0\lib\20. Error: Syste.IO.FileNotFoundException, {"Can not load ICSharpCode.SharpZipLib.dll":null} ; InnerException is null; Message "Can not load ICSharpCode.SharpZipLib.dll"; StackTrace: at SupportClass.SharpZipLib.CreateDeflater() at Lucene.Net.Documents.CompressionTools.Compress(Byte[] value_Renamed, Int32 offset, Int32 length, Int32 compressionLevel) at Lucene.Net.Documents.CompressionTools.Compress(Byte[] value_Renamed, Int32 offset, Int32 length) at Lucene.Net.Index.FieldsWriter.WriteField(FieldInfo fi, Fieldable field) at Lucene.Net.Index.StoredFieldsWriterPerThread.AddField(Fieldable field, FieldInfo fieldInfo) at Lucene.Net.Index.DocFieldProcessorPerThread.ProcessDocument() at Lucene.Net.Index.DocumentsWriter.UpdateDocument(Document doc, Analyzer analyzer, Term delTerm) at Lucene.Net.Index.DocumentsWriter.AddDocument(Document doc, Analyzer analyzer) at Lucene.Net.Index.IndexWriter.AddDocument(Document doc, Analyzer analyzer) at Lucene.Net.Index.IndexWriter.AddDocument(Document doc) at Ideiota.Business.DAL.Services.SearchEngine.Indexer.IndexIdea(Idea idea, String path, Boolean indexInTemp) in D:\Projectos\Ideiota\Code\Ideiota\Ideiota.Business.DAL.Services\SearchEngine\Indexer.cs:line 75 Thanks in advance
        Hide
        Simon Svensson added a comment -

        I'm unable to reproduce this. João, can you confirm that you have have a reference to ICSharpCode.SharpZipLib in your project, configured with Copy Local = True, and the file ICSharpCode.SharpZipLib.dll shows up in your compilation target directory? If so, could you enable the BindingFailure MDA (Debug > Exceptions, expand Managed Debugging Assistants, check BindingFailure) and retry your code? It should help you narrow in on assembly loading errors.

        Show
        Simon Svensson added a comment - I'm unable to reproduce this. João, can you confirm that you have have a reference to ICSharpCode.SharpZipLib in your project, configured with Copy Local = True, and the file ICSharpCode.SharpZipLib.dll shows up in your compilation target directory? If so, could you enable the BindingFailure MDA (Debug > Exceptions, expand Managed Debugging Assistants, check BindingFailure) and retry your code? It should help you narrow in on assembly loading errors.
        Hide
        João Rosa added a comment -

        Yes, I've this configuration, and the dll shpws up in my compilation target directory.
        I activate the BindingFailure MDA, and the stack trace is equal.

        I try a long shot, add this line before, "ICSharpCode.SharpZipLib.Zip.ZipFile zip = null;" and all gows right...
        It's very strange...

        Thanks.

        Show
        João Rosa added a comment - Yes, I've this configuration, and the dll shpws up in my compilation target directory. I activate the BindingFailure MDA, and the stack trace is equal. I try a long shot, add this line before, "ICSharpCode.SharpZipLib.Zip.ZipFile zip = null;" and all gows right... It's very strange... Thanks.
        Hide
        Simon Svensson added a comment -

        Can you reproduce this with the latest source from subversion? The ICSharpCode.SharpZipLib is loaded with an Assembly.Load in the static constructor of SupportClass.SharpZipLib, row 2178(-ish) in SupportClass.cs, but wrapped with in an try-catch without any logging. Stepping through that code line-by-line may provide some hints about the problem.

        Show
        Simon Svensson added a comment - Can you reproduce this with the latest source from subversion? The ICSharpCode.SharpZipLib is loaded with an Assembly.Load in the static constructor of SupportClass.SharpZipLib, row 2178(-ish) in SupportClass.cs, but wrapped with in an try-catch without any logging. Stepping through that code line-by-line may provide some hints about the problem.
        Hide
        Christopher Currens added a comment -

        I can't reproduce this problem, and there's been a month and a half of silence on the issue. If there's still a problem, we can reopen this later.

        Show
        Christopher Currens added a comment - I can't reproduce this problem, and there's been a month and a half of silence on the issue. If there's still a problem, we can reopen this later.

          People

          • Assignee:
            Unassigned
            Reporter:
            João Rosa
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development