Hibernate Search Order by child-count
Consider: @Indexed @Entity public class TParent implements java.io.Serializable { ..... private Set<TChild> TChildSet = new HashSet<TChild>(0); @ContainedIn @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="TParent") public Set<TChild> getTChildSet() { return this.TChildSet; } A query would be something like this: FullTextQuery hibQuery = fullTextSession.createFullTextQuery( luceneQuery ); hibQuery.setSort( ... ) How can a sort-by-child-count be achieved? In other words, the order of the TParent list returned would be dictated by the TChildSet count. I know an @Formula can be