Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
elasticsearch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
elasticsearch
Commits
372faf22c1e3
Commit
372faf22c1e3
authored
8 years ago
by
Katia Saurfelt
Browse files
Options
Downloads
Patches
Plain Diff
implement a IFullTextIndexSerializable for File
parent
4223ea3c88ce
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
entities.py
+18
-1
18 additions, 1 deletion
entities.py
hooks.py
+0
-4
0 additions, 4 deletions
hooks.py
with
18 additions
and
5 deletions
entities.py
+
18
−
1
View file @
372faf22
...
...
@@ -19,7 +19,7 @@
import
collections
from
cubicweb
import
view
from
cubicweb
import
view
,
neg_role
from
cubicweb.predicates
import
is_instance
from
cubicweb.appobject
import
AppObject
...
...
@@ -109,3 +109,20 @@
data[
'
parent
'
] = entity.entry_of[0]
"""
pass
class
File
(
IFullTextIndexSerializable
):
__select__
=
IFullTextIndexSerializable
.
__select__
&
is_instance
(
'
File
'
)
def
serialize
(
self
,
complete
=
False
):
"""
this could be a generic implementation of fulltext_containers indexation, but for
now we can not return more than one parent json which is fine
for Files
"""
for
rschema
,
role
in
self
.
_cw
.
vreg
.
schema
[
'
File
'
].
fulltext_containers
():
for
parent
in
self
.
entity
.
related
(
rschema
.
type
,
role
=
neg_role
(
role
)).
entities
():
return
parent
.
cw_adapt_to
(
'
IFullTextIndexSerializable
'
).
serialize
(
complete
)
return
{}
This diff is collapsed.
Click to expand it.
hooks.py
+
0
−
4
View file @
372faf22
...
...
@@ -43,8 +43,6 @@
category
=
'
es
'
def
__call__
(
self
):
if
self
.
entity
.
cw_etype
==
'
File
'
:
return
# FIXME hack!
IndexEsOperation
.
get_instance
(
self
.
_cw
).
add_data
(
self
.
entity
)
...
...
@@ -60,8 +58,6 @@
for
entity
in
(
self
.
_cw
.
entity_from_eid
(
self
.
eidfrom
),
self
.
_cw
.
entity_from_eid
(
self
.
eidto
)):
cw_etype
=
entity
.
cw_etype
if
cw_etype
==
'
File
'
:
return
# FIXME hack!
if
(
cw_etype
in
indexable_types
(
entity
.
_cw
.
vreg
.
schema
)
or
cw_etype
in
CUSTOM_ATTRIBUTES
):
IndexEsOperation
.
get_instance
(
self
.
_cw
).
add_data
(
entity
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment