小编use*_*299的帖子

Solr - 查询所有字段的最佳实践

schema.xml片段:

   <field name="id" type="string" indexed="true" stored="true" required="true" />
   <field name="notes" type="text_general" indexed="true" stored="true"/>
   <field name="missionFocus" type="text_general" indexed="true" stored="true"/>
   <field name="name" type="text_general" indexed="true" stored="true"/>
   <field name="first_name" type="text_general" indexed="true" stored="true"/>
   <field name="last_name" type="text_general" indexed="true" stored="true"/>
   <field name="about_me" type="text_general" indexed="true" stored="true"/>
   <field name="message" type="text_general" indexed="true" stored="true"/>
   <field name="title" type="text_general" indexed="true" stored="true"/>  
   <field name="table_type" type="string" indexed="true" stored="true"/>  

   <field name="text" type="text_general" indexed="true" stored="false" 
          multiValued="true"/>
Run Code Online (Sandbox Code Playgroud)

现在我想搜索所有字段("id"和"table_type"除外),例如"hello".我怎么能这样做?我真的要写下面的吗?

/solr/select/?q=notes:hello missionFocus:hello name:hello first_name:hello ..
Run Code Online (Sandbox Code Playgroud)

我听说过有关DisMaxRequestHandler的一些内容,但我如何使用此处理程序进行查询?我需要在solrconfig.xml中更改一些内容吗?

xml solr handler

16
推荐指数
1
解决办法
9384
查看次数

Hibernate - 双向@OneToOne

我有2个类:User和UserPicture,它们之间有1:1的关系.

public class User {
     @Id
     @GeneratedValue(strategy=GenerationType.AUTO)
     @Column(name="id", nullable = false, unique = true)
 private int id;

     private String firstname;

     private String lastname;

     @OneToOne
     @JoinColumn(name = "picture") //field named "picture" in the database
     private UserPicture userPicture;

     ..
}


public class UserPicture {

     @Id
     @GeneratedValue(strategy=GenerationType.AUTO)
     @Column(name="id", nullable = false, unique = true)
     private int id;

     private Blob image;

     @OneToOne
     @JoinColumn(name = "user")
     User user;
Run Code Online (Sandbox Code Playgroud)

UserPicture中的'user'将被加载,但User中的'userPicture'不会 - 我错了什么?

编辑 必须添加我只是创建一个UserPicture并插入它们(使用现有的userId) - 也许我需要在UserPicture级联'用户'?

hibernate one-to-one

9
推荐指数
2
解决办法
2万
查看次数

Liferay + Spring + Spring Web Mvc - @Autowired不工作

使用:liferay 6.1 spring 3.1 spring-portlet-mvc

我们尝试用@Autowired注入spring bean,看起来这不适用于liferay 6.1吗?已知错误?解决方法?

这里是我的applicationContext.xml:

  <?xml version="1.0" encoding="UTF-8"?>
  <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:util="http://www.springframework.org/schema/util"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:mvc="http://www.springframework.org/schema/mvc"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans     
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context 
   http://www.springframework.org/schema/context/spring-context-3.0.xsd
   http://www.springframework.org/schema/tx 
   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
   http://www.springframework.org/schema/util 
   http://www.springframework.org/schema/util/spring-util-3.0.xsd
   http://www.springframework.org/schema/mvc 
   http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<bean id="viewNameTranslator"
      class="org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator"/>

<bean   
class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>

<mvc:annotation-driven />
<context:annotation-config />
<context:component-scan base-package="com.ebcont.yatc.portlets.service"/>

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>classpath:configuration.properties</value>
            <value>classpath:mail.properties</value>
        </list>
    </property>
</bean>

<bean id="appProperties"
      class="org.springframework.beans.factory.config.PropertiesFactoryBean">

    <property name="singleton" value="true"/>

    <property name="properties">
        <props>
            <prop key="application.name">${application.name}</prop>
        </props>
    </property>

</bean>

<bean id="mailProperties"
      class="org.springframework.beans.factory.config.PropertiesFactoryBean">

    <property name="singleton" value="true"/>

    <property name="properties">
        <props>
            <prop key="mail.host">${mail.host}</prop>
            <prop key="mail.port">${mail.port}</prop>
            <prop key="mail.username">${mail.username}</prop> …
Run Code Online (Sandbox Code Playgroud)

spring liferay

2
推荐指数
1
解决办法
4396
查看次数

标签 统计

handler ×1

hibernate ×1

liferay ×1

one-to-one ×1

solr ×1

spring ×1

xml ×1