罗盘中没有搜索结果的数据

时间:2011-04-03 12:36:37

标签: hibernate spring search struts2 compass-lucene

我正在使用带弹簧和冬眠的指南针。我正确地获得了一些命中但是没有数据

enter image description here

Heres是我的实体类

@Entity
@Searchable(alias="patient")
public class Patient {
@Id
@GeneratedValue
@SearchableId
public Integer id;

@SearchableProperty(name="name")
public String firstName;
public String lastName;

}

Heres是动作类

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>

如果我获得了点击量,那么为什么没有数据呢

0 个答案:

没有答案