虽然一直在用Solr,但是一直没有对他进行比较深入的了解,最近正好有时间,研究了一下,主要是一直想对solr的collection进行分表,那样的话一天的数据一个表,比较规范,也比较好用。网上搜了一下,基本上都是通过多core来实现的。这里说一下创建的url:
http://127.0.0.1:8983/solr/admin/cores?action=CREATE
&name=collection2
&instanceDir=/opt/gshen/solr/collection2
&config=/opt/gshen/solr/conf/solrconfig.xml
&schema=/opt/gshen/solr/conf/schema.xml
&dataDir=/opt/gshen/solr/collection2/data
另外还有其他的参数,如:
Parameter |
Type
|
Required
|
Default
|
Description |
---|---|---|---|---|
name | string | Yes | N/A | The name of the new core. Same as "name" on the |
instanceDir | string | No | whatever is specified for "name" parameter | The directory where files for this SolrCore should be stored. Same as |
config | string | No | Name of the config file (i.e., | |
schema | string | No | Name of the schema file to use for the core. Please note that if you are using a "managed schema" (the default behavior) then any value for this property which does not match the effective | |
dataDir | string | No | Name of the data directory relative to | |
configSet | string | No | Name of the configset to use for this core. For more information, see the section Config Sets. | |
collection | string | No | The name of the collection to which this core belongs. The default is the name of the core. | |
shard | string | No | The shard id this core represents. Normally you want to be auto-assigned a shard id. | |
property.name=value | string | No | Sets the core property name to value. See the section on defining core.properties file contents. | |
async | string | No | Request ID to track this action which will be processed asynchronously |
Parameter |
Type
|
Required
|
Default
|
Description |
---|---|---|---|---|
name | string | Yes | N/A | The name of the new core. Same as "name" on the |
instanceDir | string | No | whatever is specified for "name" parameter | The directory where files for this SolrCore should be stored. Same as |
config | string | No | Name of the config file (i.e., | |
schema | string | No | Name of the schema file to use for the core. Please note that if you are using a "managed schema" (the default behavior) then any value for this property which does not match the effective | |
dataDir | string | No | Name of the data directory relative to | |
configSet | string | No | Name of the configset to use for this core. For more information, see the section Config Sets. | |
collection | string | No | The name of the collection to which this core belongs. The default is the name of the core. | |
shard | string | No | The shard id this core represents. Normally you want to be auto-assigned a shard id. | |
property.name=value | string | No | Sets the core property name to value. See the section on defining core.properties file contents. | |
async | string | No | Request ID to track this action which will be processed asynchronously |
跨core查询:
http://192.168.100.175:8080/solr/collection1/select?
q=message:中国人
&wt=json
&indent=true
&shards=192.168.100.175:8080/solr/collection1,192.168.100.175:8080/solr/collection2
这里只列出了部分属性和功能,具体可到http://wiki.apache.org/solr/CoreAdmin查询使用方法。
Parameter |
Type
|
Required
|
Default
|
Description |
---|---|---|---|---|
name | string | Yes | N/A | The name of the new core. Same as "name" on the |
instanceDir | string | No | whatever is specified for "name" parameter | The directory where files for this SolrCore should be stored. Same as |
config | string | No | Name of the config file (i.e., | |
schema | string | No | Name of the schema file to use for the core. Please note that if you are using a "managed schema" (the default behavior) then any value for this property which does not match the effective | |
dataDir | string | No | Name of the data directory relative to | |
configSet | string | No | Name of the configset to use for this core. For more information, see the section Config Sets. | |
collection | string | No | The name of the collection to which this core belongs. The default is the name of the core. | |
shard | string | No | The shard id this core represents. Normally you want to be auto-assigned a shard id. | |
property.name=value | string | No | Sets the core property name to value. See the section on defining core.properties file contents. | |
async | string | No | Request ID to track this action which will be processed asynchronously |