package org.codelibs.fess.suggest.entity;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

public class ElevateWord implements Serializable {

    private static final long serialVersionUID = 1L;

    protected final String elevateWord;
    protected final float boost;
    protected final List<String> readings;
    protected final List<String> fields;
    protected final List<String> tags;
    protected final List<String> roles;

    public ElevateWord(final String elevateWord, final float boost, final List<String> readings, final List<String> fields,
            final List<String> tags, final List<String> roles) {
        this.elevateWord = elevateWord;
        this.boost = boost;
        this.readings = readings;
        this.fields = fields;
        if (tags == null) {
            this.tags = Collections.emptyList();
        } else {
            this.tags = tags;
        }
        if (roles == null) {
            this.roles = Collections.emptyList();
        } else {
            this.roles = roles;
        }
    }

    public String getElevateWord() {
        return elevateWord;
    }

    public float getBoost() {
        return boost;
    }

    public List<String> getReadings() {
        return readings;
    }

    public List<String> getFields() {
        return fields;
    }

    public List<String> getTags() {
        return tags;
    }

    public List<String> getRoles() {
        return roles;
    }

    public SuggestItem toSuggestItem() {
        return new SuggestItem(new String[] { this.getElevateWord() }, new String[][] { this.getReadings().toArray(
                new String[this.getReadings().size()]) }, fields.toArray(new String[fields.size()]), 1, 0, this.getBoost(), this.getTags()
                .toArray(new String[this.getTags().size()]), this.getRoles().toArray(new String[this.getRoles().size()]), null,
                SuggestItem.Kind.USER);
    }
}

@@ -1516,70 +1516,98 @@
     
-return new SuggestItem(new String%5B%5D %7B this.getElevateWord() %7D,
+final String%5B%5D%5B%5D readingArray =%0A                this.getReadings().stream().map(reading -%3E
  new
@@ -1619,30 +1619,20 @@
 ng%5B%5D
-%5B%5D
  %7B 
-this.getR
+r
 eading
-s(
+ %7D
 ).to
@@ -1637,33 +1637,80 @@
 toArray(
-%0A                
+(count) -%3E new String%5Bcount%5D%5B%5D);%0A        return new SuggestItem(
 new Stri
@@ -1712,24 +1712,28 @@
  String%5B
+%5D %7B 
 this.get
 Readings
@@ -1728,29 +1728,37 @@
 .get
-Readings().size()%5D) %7D
+ElevateWord() %7D, readingArray
 , fi
@@ -1803,16 +1803,32 @@
 ), 1, 0,
+%0A               
  this.ge
@@ -1851,33 +1851,16 @@
 etTags()
-%0A                
 .toArray
@@ -1912,32 +1912,57 @@
 Roles().toArray(
+%0A                        
 new String%5Bthis.
@@ -1987,32 +1987,16 @@
 ), null,
-%0A               
  Suggest

add multiple reading to elevate word