Skip to content

Instantly share code, notes, and snippets.

@public
Created May 14, 2012 15:59
Show Gist options
  • Select an option

  • Save public/2694725 to your computer and use it in GitHub Desktop.

Select an option

Save public/2694725 to your computer and use it in GitHub Desktop.
In [1]: import restpose
In [2]: r = restpose.Server('http://localhost:7777')
In [3]: d = {"artists|Artist": {"info": {"type": "text", "group": "n"}, "score": {"slot": 0, "type": "double"}, "name": {"type": "text", "group": "n", "wdfinc": 5}}}
In [4]: core = r.collection("core")
In [5]: core.checkpoint().wait()
Out[5]: <restpose.client.CheckPoint object at 0x4346c90>
In [6]: conf = core.config
In [7]: conf["types"].update(d)
In [8]: conf["types"]
Out[8]:
{'artists|Artist': {'info': {'group': 'n', 'type': 'text'},
'name': {'group': 'n', 'type': 'text', 'wdfinc': 5},
'score': {'slot': 0, 'type': 'double'}}}
In [9]: core.config = conf
In [10]: core.config
Out[10]:
{u'default_type': {u'patterns': [[u'*_text',
{u'group': u't*',
u'processor': u'stem_en',
u'store_field': u'*_text',
u'type': u'text'}],
[u'text',
{u'group': u't',
u'processor': u'stem_en',
u'store_field': u'text',
u'type': u'text'}],
[u'*_num',
{u'slot': u'n*',
u'store_field': u'*_num',
u'type': u'double'}],
[u'num',
{u'slot': u'n',
u'store_field': u'num',
u'type': u'double'}],
[u'*_time',
{u'slot': u'd*',
u'store_field': u'*_time',
u'type': u'timestamp'}],
[u'time',
{u'slot': u'd',
u'store_field': u'time',
u'type': u'timestamp'}],
[u'*_tag',
{u'group': u'g*',
u'max_length': 100,
u'slot': u'g*',
u'store_field': u'*_tag',
u'too_long_action': u'hash',
u'type': u'exact'}],
[u'tag',
{u'group': u'g',
u'max_length': 100,
u'slot': u'g',
u'store_field': u'tag',
u'too_long_action': u'hash',
u'type': u'exact'}],
[u'*_url',
{u'group': u'u*',
u'max_length': 100,
u'slot': u'u*',
u'store_field': u'*_url',
u'too_long_action': u'hash',
u'type': u'exact'}],
[u'url',
{u'group': u'u',
u'max_length': 100,
u'slot': u'u',
u'store_field': u'url',
u'too_long_action': u'hash',
u'type': u'exact'}],
[u'*_cat',
{u'group': u'c*',
u'max_length': 32,
u'slot': u'c*',
u'store_field': u'*_cat',
u'taxonomy': u'*_cat',
u'too_long_action': u'hash',
u'type': u'cat'}],
[u'cat',
{u'group': u'c',
u'max_length': 32,
u'slot': u'c',
u'store_field': u'cat',
u'taxonomy': u'cat',
u'too_long_action': u'hash',
u'type': u'cat'}],
[u'*_lonlat',
{u'slot': u'l*',
u'store_field': u'*_lonlat',
u'type': u'lonlat'}],
[u'lonlat',
{u'slot': u'l',
u'store_field': u'lonlat',
u'type': u'lonlat'}],
[u'id',
{u'store_field': u'id', u'type': u'id'}],
[u'type',
{u'group': u'!',
u'slot': 1,
u'store_field': u'type',
u'type': u'exact'}],
[u'_meta',
{u'group': u'#',
u'slot': 0,
u'type': u'meta'}],
[u'*',
{u'group': u't',
u'store_field': u'*',
u'type': u'text'}]]},
u'format': 3,
u'special_fields': {u'id_field': u'id',
u'meta_field': u'_meta',
u'type_field': u'type'},
u'types': {u'artists|Artist': {u'patterns': []}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment