@Entity
@Indexed
@SequenceGenerator(name="subjectSeq", sequenceName="subjectSeq")
public class AppInfo {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="subjectSeq")
public Integer id;
public Integer district;
@Field
@Boost(2.0f)
public String appName;
public String thumbnail;
public Integer statistics;
@Field
public String description;
public Integer publisher;
public Date publishAt = new Date();
@ManyToOne
@IndexedEmbedded
@Boost(1.5f)
@JoinColumn(name="type")
public AppType type;
@ManyToMany
@JoinTable(name="appInfo_appCatalog",
joinColumns={@JoinColumn(name="info_id", referencedColumnName="id")},
inverseJoinColumns={@JoinColumn(name="catalog_id", referencedColumnName="id")})
@IndexedEmbedded
@Boost(1.5f)
public List<AppCatalog> catalogs;
}
@Entity
@SequenceGenerator(name="appTypeSeq", sequenceName="appTypeSeq")
public class AppType {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="appTypeSeq")
public Integer id;
@Field
public String name;
}
我的搜索代码是:
QueryBuilder qb = fullTextEntityManager.getSearchFactory()
.buildQueryBuilder().forEntity( AppInfo.class ).get();
org.apache.lucene.search.Query query = qb
.keyword().fuzzy()
.onFields("appName", "description", "type.name", "catalogs.name")
.matching(searchString)
.createQuery();
问题是匹配字段“appName”和“description”的“searchString”有结果,但匹配“type.name”或“catalogs.name”的没有结果
实体 AppType 是否没有索引?