File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Takes a version, parent (lvl0) and a "guide item" object and transforms it to the payload that needs to be stored in algolia
3
+ * @param {Object } version - Ember version string
4
+ * @param {Object } parent - Parent object to be used for lvl0 hierarchy
5
+ * @param {Object } item - The object to transform
6
+ * @returns {Object }
7
+ */
8
+ export default function guideItemSchema ( version , parent , item ) {
9
+ // console.log('item', item);
10
+ const skipTocTag = item [ 'skip-toc' ] ? `skipTOC:true` : `skipTOC:false` ;
11
+
12
+ return {
13
+ title : item . title ,
14
+ id : item . id ,
15
+ url : item . url ,
16
+ content : item . attributes . content ,
17
+ description : item . attributes . description ,
18
+
19
+ _tags : [
20
+ `version:${ version } ` ,
21
+ skipTocTag
22
+ ] ,
23
+
24
+ hierarchy : {
25
+ lvl0 : parent . title ,
26
+ lvl1 : item . title
27
+ }
28
+ } ;
29
+ }
Original file line number Diff line number Diff line change 1
1
import classSchema from './class' ;
2
2
import moduleSchema from './module' ;
3
3
import methodSchema from './method' ;
4
+ import guideItemSchema from './guideItem' ;
4
5
5
6
export default {
6
7
moduleSchema,
7
8
classSchema,
8
- methodSchema
9
+ methodSchema,
10
+ guideItemSchema
9
11
} ;
You can’t perform that action at this time.
0 commit comments