Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8449

Code Optimizations in FieldTermStack

Details

    • New

    Description

      1) "vector.hasPositions() == false" in FieldTermStack's constructor

      can be changed to "!vector.hasPositions()"

       

      2) "public TermInfo(String, int, int, int, float)" constructor

      can be change to "TermInfo(String, int, int, int, float)"

       

      3) TermInfo's toString method

      public String toString() {
      	StringBuilder sb = new StringBuilder();
      	sb.append( text ).append( '(' ).append(startOffset).append	( ',' ).append( endOffset ).append( ',' ).append( position ).append( ')' );
      	return sb.toString();
      }

      This code can be changed to

       

      public String toString(){
        return text + '(' + startOffset + ',' + endOffset + ',' + position + ')';
      }
      

      this code.

       

       

      4) TermInfo's equals method

      public boolean equals(Object obj) {
      	...
      	if (position != other.position) {
              	return false;
      	}
      	return true;
      }
      

      This code can be changed to

       

      public boolean equals(Object obj) {
      	...
      	return position == other.position;
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            danmuzi Namgyu Kim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: