Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
elasticsearch
Commits
daec5a438987
Commit
c049b5e3
authored
Feb 18, 2017
by
Samuel Trégouët
Browse files
add all-in-one variable to configure indexable etypes
parent
a0fa54761a3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
ccplugin.py
View file @
daec5a43
...
...
@@ -63,6 +63,8 @@ class IndexInES(Command):
if
es
:
if
self
.
config
.
etypes
:
etypes
=
self
.
config
.
etypes
elif
cnx
.
vreg
.
config
[
'indexable-etypes'
]:
etypes
=
cnx
.
vreg
.
config
[
'indexable-etypes'
]
else
:
etypes
=
indexable_types
(
schema
,
custom_skip_list
=
self
.
config
.
except_etypes
)
...
...
hooks.py
View file @
daec5a43
...
...
@@ -43,6 +43,11 @@ class ContentUpdateIndexES(hook.Hook):
category
=
'es'
def
__call__
(
self
):
indexable_etypes
=
self
.
_cw
.
vreg
.
config
[
'indexable-etypes'
]
if
indexable_etypes
:
if
self
.
entity
.
cw_etype
in
indexable_etypes
:
IndexEsOperation
.
get_instance
(
self
.
_cw
).
add_data
(
self
.
entity
)
return
if
self
.
entity
.
cw_etype
==
'File'
:
return
# FIXME hack!
IndexEsOperation
.
get_instance
(
self
.
_cw
).
add_data
(
self
.
entity
)
...
...
@@ -62,6 +67,11 @@ class RelationsUpdateIndexES(hook.Hook):
cw_etype
=
entity
.
cw_etype
if
cw_etype
==
'File'
:
return
# FIXME hack!
indexable_etypes
=
self
.
_cw
.
vreg
.
config
[
'indexable-etypes'
]
if
indexable_etypes
:
if
entity
.
cw_etype
in
indexable_etypes
:
IndexEsOperation
.
get_instance
(
self
.
_cw
).
add_data
(
entity
)
continue
if
(
cw_etype
in
indexable_types
(
entity
.
_cw
.
vreg
.
schema
)
or
cw_etype
in
CUSTOM_ATTRIBUTES
):
IndexEsOperation
.
get_instance
(
self
.
_cw
).
add_data
(
entity
)
...
...
site_cubicweb.py
View file @
daec5a43
options
=
(
(
'indexable-etypes'
,
{
'type'
:
'csv'
,
'default'
:
''
,
'help'
:
'comma separated list of entity types to consider when indexing '
'with index-in-es command and from `es` hooks '
,
'group'
:
'elasticsearch'
,
'level'
:
5
,
}),
(
'elasticsearch-locations'
,
{
'type'
:
'string'
,
'default'
:
''
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment