No data in hits of search results in compass
I am using compass with spring and hibernate. I am getting a number of hits correctly but there is no data in them
Heres is my entity class
@Entity
@Searchable(alias="patient")
public class Patient {
@Id
@GeneratedValue
@SearchableId
public Integer id;
@SearchableProperty(name="name")
public String firstName;
public String lastName;
}
Heres is the action class
public class SearchAction extends ActionSupport {
Compass compass;
CompassGps compassGps;
String query;
CompassHit[] hits;
CompassSearchCommand searchCommand;
CompassSearchResults searchResults;
public String list()
{
if (searchHelper == null) {
searchHelper = new CompassSearchHelper(compass, 10);
}
searchCommand = new CompassSearchCommand(query, 10);
if (!StringUtils.hasText(searchCommand.getQuery())) {
return "LIST";
}
searchResults = searchHelper.search(searchCommand);
hits = searchResults.getHits();
return "RESULTS";
}
}
Here is my application-context.xml
<bean id="compass" class="org.compass.spring.LocalCompassBean">
<property name="resourceLocations">
<list>
<value>classpath:medics.cmd.xml</value>
</list>
</property>
<property name="compassConfiguration" ref="annotationConfiguration"/>
<property name="compassSettings">
<props>
<prop key="compass.engine.connection">file:///compass/medics</prop>
<prop key="compass.transaction.factory">org.compass.spring.transaction.SpringSyncTransactionFactory</prop>
</props>
</property>
<property name="transactionManager">
<ref local="transactionManager" 开发者_JAVA技巧/>
</property>
<property name="classMappings">
<list>
<value>com.medics.entities.Appointment</value>
<value>com.medics.entities.Patient</value>
<value>com.medics.entities.Users</value>
</list>
</property>
</bean>
<bean id="hibernateGpsDevice" class="org.compass.gps.device.hibernate.HibernateGpsDevice">
<property name="name"><value>hibernateDevice</value></property>
<property name="sessionFactory"><ref local="sessionFactory" /></property>
<property name="nativeExtractor"><bean class="org.compass.spring.device.hibernate.SpringNativeHibernateExtractor" /></property>
</bean>
<bean id="compassGps" class="org.compass.gps.impl.SingleCompassGps" init-method="start" destroy-method="stop">
<property name="compass"><ref bean="compass" /></property>
<property name="gpsDevices">
<list>
<ref bean="hibernateGpsDevice" />
</list>
</property>
</bean>
<bean id="annotationConfiguration" class="org.compass.annotations.config.CompassAnnotationsConfiguration"></bean>
If I am getting the hits then why is there no data in them
精彩评论