指南针搜索结果点击中没有数据

发布于 2024-10-30 10:20:40 字数 3199 浏览 1 评论 0原文

我正在使用带有 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

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文