You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Iliev Andrei (JIRA)" <ji...@apache.org> on 2009/09/10 16:24:57 UTC

[jira] Created: (LUCENENET-194) Bug in Lucene.Net.Document.Document.cs GetFieldables method

Bug in Lucene.Net.Document.Document.cs GetFieldables method
-----------------------------------------------------------

                 Key: LUCENENET-194
                 URL: https://issues.apache.org/jira/browse/LUCENENET-194
             Project: Lucene.Net
          Issue Type: Bug
            Reporter: Iliev Andrei


		public Fieldable[] GetFieldables(System.String name)
		{
			/*****skip***/
			return (Fieldable[]) result.ToArray(typeof(Field)); 
		}

 SHOULD BE 
return (Fieldable[]) result.ToArray(typeof(Fieldable)), 

otherwise exception will arise.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LUCENENET-194) Bug in Lucene.Net.Document.Document.cs GetFieldables method

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756153#action_12756153 ] 

Digy commented on LUCENENET-194:
--------------------------------

Thanks Iliev.

I committed the patch for 2.3.1, 2.3.2 and 2.4.0

DIGY

> Bug in Lucene.Net.Document.Document.cs GetFieldables method
> -----------------------------------------------------------
>
>                 Key: LUCENENET-194
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-194
>             Project: Lucene.Net
>          Issue Type: Bug
>            Reporter: Iliev Andrei
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> 		public Fieldable[] GetFieldables(System.String name)
> 		{
> 			/*****skip***/
> 			return (Fieldable[]) result.ToArray(typeof(Field)); 
> 		}
>  SHOULD BE 
> return (Fieldable[]) result.ToArray(typeof(Fieldable)), 
> otherwise exception will arise.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (LUCENENET-194) Bug in Lucene.Net.Document.Document.cs GetFieldables method

Posted by "xzxz@mail.ru" <xz...@mail.ru>.
Ok. Here is the case:

===========code===================
  public static void TestGetFieldables()
        {
            byte[] bin = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            Directory dir = new Lucene.Net.Store.RAMDirectory();   
            IndexWriter writer = new IndexWriter(dir, new 
WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
            Document doc = new Document();
            doc.Add(new Field("bin1", bin, Field.Store.YES));
            doc.Add(new Field("bin2", bin, Field.Store.COMPRESS));
            doc.Add(new Field("junk", "junk text", Field.Store.NO, 
Field.Index.ANALYZED));

            writer.AddDocument(doc);
            writer.Close();

            IndexReader reader = IndexReader.Open(dir);
             System.Collections.Hashtable lazyFields = new 
System.Collections.Hashtable();
            lazyFields["bin1"] = "bin1";
            FieldSelector sel = new SetBasedFieldSelector(new 
System.Collections.Hashtable(), lazyFields);
            doc = reader.Document(reader.MaxDoc() - 1, sel);
            Lucene.Net.Documents.Fieldable[] fieldables = 
doc.GetFieldables("bin1") as Lucene.Net.Documents.Fieldable[];  // <- 
Exception is here
            System.Diagnostics.Debug.Assert(fieldables!=null);
            System.Diagnostics.Debug.Assert(1== fieldables.Length);
            reader.Close();
   
        }
===========/code===================

System.InvalidCastException was unhandled
  Message="At least one element in the source array could not be cast 
down to the destination array type."
  Source="mscorlib"
 ==============================

Digy (JIRA) пишет:
>     [ https://issues.apache.org/jira/browse/LUCENENET-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755601#action_12755601 ] 
>
> Digy commented on LUCENENET-194:
> --------------------------------
>
> Hi Iliev,
>
> Everything works fine. I get no exceptions.
>
> Can you post a test case showing the bug?
>
> DIGY
>
>   
>> Bug in Lucene.Net.Document.Document.cs GetFieldables method
>> -----------------------------------------------------------
>>
>>                 Key: LUCENENET-194
>>                 URL: https://issues.apache.org/jira/browse/LUCENENET-194
>>             Project: Lucene.Net
>>          Issue Type: Bug
>>            Reporter: Iliev Andrei
>>   Original Estimate: 0h
>>  Remaining Estimate: 0h
>>
>> 		public Fieldable[] GetFieldables(System.String name)
>> 		{
>> 			/*****skip***/
>> 			return (Fieldable[]) result.ToArray(typeof(Field)); 
>> 		}
>>  SHOULD BE 
>> return (Fieldable[]) result.ToArray(typeof(Fieldable)), 
>> otherwise exception will arise.  
>>     
>
>   


[jira] Commented: (LUCENENET-194) Bug in Lucene.Net.Document.Document.cs GetFieldables method

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755601#action_12755601 ] 

Digy commented on LUCENENET-194:
--------------------------------

Hi Iliev,

Everything works fine. I get no exceptions.

Can you post a test case showing the bug?

DIGY

> Bug in Lucene.Net.Document.Document.cs GetFieldables method
> -----------------------------------------------------------
>
>                 Key: LUCENENET-194
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-194
>             Project: Lucene.Net
>          Issue Type: Bug
>            Reporter: Iliev Andrei
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> 		public Fieldable[] GetFieldables(System.String name)
> 		{
> 			/*****skip***/
> 			return (Fieldable[]) result.ToArray(typeof(Field)); 
> 		}
>  SHOULD BE 
> return (Fieldable[]) result.ToArray(typeof(Fieldable)), 
> otherwise exception will arise.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LUCENENET-194) Bug in Lucene.Net.Document.Document.cs GetFieldables method

Posted by "Digy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy closed LUCENENET-194.
--------------------------

    Resolution: Fixed
      Assignee: Digy

> Bug in Lucene.Net.Document.Document.cs GetFieldables method
> -----------------------------------------------------------
>
>                 Key: LUCENENET-194
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-194
>             Project: Lucene.Net
>          Issue Type: Bug
>            Reporter: Iliev Andrei
>            Assignee: Digy
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> 		public Fieldable[] GetFieldables(System.String name)
> 		{
> 			/*****skip***/
> 			return (Fieldable[]) result.ToArray(typeof(Field)); 
> 		}
>  SHOULD BE 
> return (Fieldable[]) result.ToArray(typeof(Fieldable)), 
> otherwise exception will arise.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.