指南针搜索结果点击中没有数据
我正在使用带有 spring 和 hibernate 的指南针。我正确地获得了一些点击,但其中没有数据
这是我的实体类
@Entity
@Searchable(alias="patient")
public class Patient {
@Id
@GeneratedValue
@SearchableId
public Integer id;
@SearchableProperty(name="name")
public String firstName;
public String lastName;
}
这是操作类
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";
}
}
这是我的 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" />
</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>
如果我得到了点击,那么为什么其中没有数据
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" />
</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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论