hi;
I have 2 entities in my project.
Code:
@Entity
@Indexed
public class Content implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Lob
@Field(name = "text", analyze = Analyze.YES, store = Store.YES)
private String text;
@ContainedIn
@ManyToOne
private Title title;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Mevzuat getTitle() {
return title;
}
public void setTitle(Title title) {
this.title = title;
}
}
Code:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Indexed
public class Title implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToMany(mappedBy = "title")
@IndexedEmbedded(depth = 1)
private Set<Content> contentList;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Set<Content> getContentList() {
return contentList;
}
public void setContentList(Set<Content> contentList) {
this.contentList = contentList;
}
}
I want to create query like this;
Code:
Query luceneQuery = parser.parse("contentList.text:hibernate and contentList.text:query");
Query query = fts.createQuery( luceneQuery, Title.class );
i want to try this for getting rows in contentList each rows have "hibernate" and "query" text. But search engine not querying for each rows, its querying whole list contains these words.
For querying embededindex for eachrows, what sould i do?