lucene-lucene-net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Franklin Simmons (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LUCENENET-183) SegmentTermVector IndexOf method always fails
Date Mon, 01 Jun 2009 14:15:07 GMT

     [ https://issues.apache.org/jira/browse/LUCENENET-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Franklin Simmons updated LUCENENET-183:
---------------------------------------

    Attachment: SegmentTermVector.patch

I've attached the very simple patch.  This best remedy was suggested by Eyal Post.

{noformat}
public virtual int IndexOf(System.String termText)
{
	if (terms == null)
		return - 1;
    int res = System.Array.BinarySearch(terms, termText, StringComparer.Ordinal);
	return res >= 0 ? res : - 1;
}
{noformat}

> SegmentTermVector IndexOf method always fails
> ---------------------------------------------
>
>                 Key: LUCENENET-183
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-183
>             Project: Lucene.Net
>          Issue Type: Bug
>            Reporter: Franklin Simmons
>         Attachments: SegmentTermVector.patch
>
>
> At index time term vectors are sorted using String.CompareOrdinal. However method IndexOf
of class SegmentTermVector invokes System.Array.BinarySearch, which is using String.Compare.
> {noformat}public virtual int IndexOf(System.String termText)
> {
> 	if (terms == null)
> 		return - 1;
>     int res = System.Array.BinarySearch(terms, termText);
> 	return res >= 0 ? res : - 1;
> }
> {noformat}
> The effect is that the IndexOf method always returns a negative number (no match) because
the sort order is incompatible with the default comparer.

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


Mime
View raw message