0

是否有schema.xml从数据库模式创建 Solr 的工具或库?我们试图避免定义和维护成百上千的字段,并使索引表的过程更加流畅。

我们正在寻找类似的东西:

table
(
    id INTEGER NOT NULL,
    type INTEGER NOT NULL,
    name VARCHAR(255) NOT NULL
);

至,

<field name="id" type="integer" indexed="true" stored="true" multiValued="true"/>
<field name="type" type="integer" indexed="true" stored="true" multiValued="true"/>
<field name="name" type="string" indexed="true" stored="true" multiValued="true"/>

或者,如果不存在任何类型的东西,那么将大表映射到 Solr 的好策略是什么?

4

1 回答 1

1

The problem with database to Solr mapping is that there are too many different databases and lack of standards on DB types (just look at frameworks like Hibernate which attempt to handle every corner case).

On top of that you have all sorts of Solr-specific complexities (analyzers, filters, sorting, etc.) which makes it quite hard to make a generic mapping tool.

Anyway, I believe that few major types should cover most of the cases:

  • LongField (signed 64 bit long)
  • IntField (signed 32 bit int)
  • StrField (single string)
  • TextField (text)
  • DoubleField (64-bit IEEE floating point)
  • BoolField (boolean)

For a complete list of Solr types, refer to the manual.

于 2012-12-27T10:18:17.017 回答