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

SegmentTermVector IndexOf method always fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      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.

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

      The effect is that the IndexOf method always returns a negative number (no match) because the sort order is incompatible with the default comparer.

      Attachments

        1. SegmentTermVector-2.patch
          3 kB
          Franklin Simmons
        2. SegmentTermVector.patch
          3 kB
          Franklin Simmons

        Activity

          People

            Unassigned Unassigned
            franklin Franklin Simmons
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: