search from english, fix #467
This commit is contained in:
@@ -5,31 +5,24 @@ dependencies:
|
|||||||
config:
|
config:
|
||||||
- field.storage.node.body
|
- field.storage.node.body
|
||||||
- field.storage.node.field_description
|
- field.storage.node.field_description
|
||||||
|
- field.storage.node.field_entrees
|
||||||
|
- field.storage.node.field_genres
|
||||||
|
- field.storage.taxonomy_term.field_synonyms
|
||||||
|
- field.storage.node.field_langues
|
||||||
|
- field.storage.node.field_locuteurs
|
||||||
- field.storage.node.field_transcript_trad
|
- field.storage.node.field_transcript_trad
|
||||||
- field.storage.node.field_transcript_vo
|
- field.storage.node.field_transcript_vo
|
||||||
- field.storage.node.field_entrees
|
|
||||||
- field.storage.node.field_locuteurs
|
|
||||||
- field.storage.node.field_workflow
|
- field.storage.node.field_workflow
|
||||||
- field.storage.node.field_genres
|
|
||||||
- field.storage.node.field_langues
|
|
||||||
- field.storage.taxonomy_term.field_synonyms
|
|
||||||
- search_api.server.edlp_db
|
- search_api.server.edlp_db
|
||||||
module:
|
module:
|
||||||
- taxonomy
|
- taxonomy
|
||||||
- search_api
|
|
||||||
- node
|
- node
|
||||||
|
- search_api
|
||||||
id: collection
|
id: collection
|
||||||
name: Collection
|
name: Collection
|
||||||
description: ''
|
description: ''
|
||||||
read_only: false
|
read_only: false
|
||||||
field_settings:
|
field_settings:
|
||||||
node_grants:
|
|
||||||
label: 'Node access information'
|
|
||||||
property_path: search_api_node_grants
|
|
||||||
type: string
|
|
||||||
indexed_locked: true
|
|
||||||
type_locked: true
|
|
||||||
hidden: true
|
|
||||||
body:
|
body:
|
||||||
label: Article
|
label: Article
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
@@ -38,12 +31,6 @@ field_settings:
|
|||||||
dependencies:
|
dependencies:
|
||||||
config:
|
config:
|
||||||
- field.storage.node.body
|
- field.storage.node.body
|
||||||
title:
|
|
||||||
label: Title
|
|
||||||
datasource_id: 'entity:node'
|
|
||||||
property_path: title
|
|
||||||
type: text
|
|
||||||
boost: !!float 3
|
|
||||||
field_description:
|
field_description:
|
||||||
label: Description
|
label: Description
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
@@ -53,6 +40,55 @@ field_settings:
|
|||||||
dependencies:
|
dependencies:
|
||||||
config:
|
config:
|
||||||
- field.storage.node.field_description
|
- field.storage.node.field_description
|
||||||
|
field_entrees:
|
||||||
|
label: Entrée(s)
|
||||||
|
datasource_id: 'entity:node'
|
||||||
|
property_path: field_entrees
|
||||||
|
type: integer
|
||||||
|
dependencies:
|
||||||
|
config:
|
||||||
|
- field.storage.node.field_entrees
|
||||||
|
field_genres:
|
||||||
|
label: 'Genre(s) » Taxonomy term » Name'
|
||||||
|
datasource_id: 'entity:node'
|
||||||
|
property_path: 'field_genres:entity:name'
|
||||||
|
type: text
|
||||||
|
dependencies:
|
||||||
|
config:
|
||||||
|
- field.storage.node.field_genres
|
||||||
|
module:
|
||||||
|
- taxonomy
|
||||||
|
- taxonomy
|
||||||
|
field_langues:
|
||||||
|
label: 'Langue(s) » Taxonomy term » Name'
|
||||||
|
datasource_id: 'entity:node'
|
||||||
|
property_path: 'field_langues:entity:name'
|
||||||
|
type: text
|
||||||
|
dependencies:
|
||||||
|
config:
|
||||||
|
- field.storage.node.field_langues
|
||||||
|
module:
|
||||||
|
- taxonomy
|
||||||
|
- taxonomy
|
||||||
|
field_locuteurs:
|
||||||
|
label: Locuteur(s)
|
||||||
|
datasource_id: 'entity:node'
|
||||||
|
property_path: field_locuteurs
|
||||||
|
type: integer
|
||||||
|
dependencies:
|
||||||
|
config:
|
||||||
|
- field.storage.node.field_locuteurs
|
||||||
|
field_synonyms:
|
||||||
|
label: 'Genre(s) » Taxonomy term » Synonyms'
|
||||||
|
datasource_id: 'entity:node'
|
||||||
|
property_path: 'field_genres:entity:field_synonyms'
|
||||||
|
type: text
|
||||||
|
dependencies:
|
||||||
|
config:
|
||||||
|
- field.storage.node.field_genres
|
||||||
|
- field.storage.taxonomy_term.field_synonyms
|
||||||
|
module:
|
||||||
|
- taxonomy
|
||||||
field_transcript_trad:
|
field_transcript_trad:
|
||||||
label: 'Transcription (Traduction)'
|
label: 'Transcription (Traduction)'
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
@@ -71,20 +107,26 @@ field_settings:
|
|||||||
dependencies:
|
dependencies:
|
||||||
config:
|
config:
|
||||||
- field.storage.node.field_transcript_vo
|
- field.storage.node.field_transcript_vo
|
||||||
status:
|
field_workflow:
|
||||||
label: status
|
label: Workflow
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
property_path: status
|
property_path: field_workflow
|
||||||
type: boolean
|
type: string
|
||||||
indexed_locked: true
|
dependencies:
|
||||||
type_locked: true
|
config:
|
||||||
uid:
|
- field.storage.node.field_workflow
|
||||||
label: uid
|
langcode:
|
||||||
|
label: Langue
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
property_path: uid
|
property_path: langcode
|
||||||
type: integer
|
type: string
|
||||||
indexed_locked: true
|
dependencies:
|
||||||
type_locked: true
|
module:
|
||||||
|
- node
|
||||||
|
language_with_fallback:
|
||||||
|
label: 'Language (with fallback)'
|
||||||
|
property_path: language_with_fallback
|
||||||
|
type: string
|
||||||
name:
|
name:
|
||||||
label: 'Entrée(s) » Taxonomy term » Name'
|
label: 'Entrée(s) » Taxonomy term » Name'
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
@@ -95,61 +137,43 @@ field_settings:
|
|||||||
- field.storage.node.field_entrees
|
- field.storage.node.field_entrees
|
||||||
module:
|
module:
|
||||||
- taxonomy
|
- taxonomy
|
||||||
field_entrees:
|
- taxonomy
|
||||||
label: Entrée(s)
|
node_grants:
|
||||||
datasource_id: 'entity:node'
|
label: 'Node access information'
|
||||||
property_path: field_entrees
|
property_path: search_api_node_grants
|
||||||
type: integer
|
|
||||||
dependencies:
|
|
||||||
config:
|
|
||||||
- field.storage.node.field_entrees
|
|
||||||
field_locuteurs:
|
|
||||||
label: Locuteur(s)
|
|
||||||
datasource_id: 'entity:node'
|
|
||||||
property_path: field_locuteurs
|
|
||||||
type: integer
|
|
||||||
dependencies:
|
|
||||||
config:
|
|
||||||
- field.storage.node.field_locuteurs
|
|
||||||
field_workflow:
|
|
||||||
label: Workflow
|
|
||||||
datasource_id: 'entity:node'
|
|
||||||
property_path: field_workflow
|
|
||||||
type: string
|
type: string
|
||||||
dependencies:
|
indexed_locked: true
|
||||||
config:
|
type_locked: true
|
||||||
- field.storage.node.field_workflow
|
hidden: true
|
||||||
field_genres:
|
status:
|
||||||
label: 'Genre(s) » Taxonomy term » Name'
|
label: status
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
property_path: 'field_genres:entity:name'
|
property_path: status
|
||||||
type: text
|
type: boolean
|
||||||
|
indexed_locked: true
|
||||||
|
type_locked: true
|
||||||
dependencies:
|
dependencies:
|
||||||
config:
|
|
||||||
- field.storage.node.field_genres
|
|
||||||
module:
|
module:
|
||||||
- taxonomy
|
- node
|
||||||
field_langues:
|
title:
|
||||||
label: 'Langue(s) » Taxonomy term » Name'
|
label: Title
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
property_path: 'field_langues:entity:name'
|
property_path: title
|
||||||
type: text
|
type: text
|
||||||
|
boost: !!float 3
|
||||||
dependencies:
|
dependencies:
|
||||||
config:
|
|
||||||
- field.storage.node.field_langues
|
|
||||||
module:
|
module:
|
||||||
- taxonomy
|
- node
|
||||||
field_synonyms:
|
uid:
|
||||||
label: 'Genre(s) » Taxonomy term » Synonyms'
|
label: uid
|
||||||
datasource_id: 'entity:node'
|
datasource_id: 'entity:node'
|
||||||
property_path: 'field_genres:entity:field_synonyms'
|
property_path: uid
|
||||||
type: text
|
type: integer
|
||||||
|
indexed_locked: true
|
||||||
|
type_locked: true
|
||||||
dependencies:
|
dependencies:
|
||||||
config:
|
|
||||||
- field.storage.node.field_genres
|
|
||||||
- field.storage.taxonomy_term.field_synonyms
|
|
||||||
module:
|
module:
|
||||||
- taxonomy
|
- node
|
||||||
datasource_settings:
|
datasource_settings:
|
||||||
'entity:node':
|
'entity:node':
|
||||||
bundles:
|
bundles:
|
||||||
@@ -157,31 +181,17 @@ datasource_settings:
|
|||||||
selected:
|
selected:
|
||||||
- enregistrement
|
- enregistrement
|
||||||
languages:
|
languages:
|
||||||
default: true
|
default: false
|
||||||
selected: { }
|
selected:
|
||||||
|
- en
|
||||||
|
- fr
|
||||||
processor_settings:
|
processor_settings:
|
||||||
entity_status: { }
|
|
||||||
rendered_item: { }
|
|
||||||
tokenizer:
|
|
||||||
all_fields: true
|
|
||||||
fields:
|
|
||||||
- body
|
|
||||||
- title
|
|
||||||
- field_description
|
|
||||||
- field_transcript_trad
|
|
||||||
- field_transcript_vo
|
|
||||||
- name
|
|
||||||
- field_genres
|
|
||||||
- field_langues
|
|
||||||
- field_synonyms
|
|
||||||
spaces: ''
|
|
||||||
overlap_cjk: 1
|
|
||||||
minimum_word_size: '3'
|
|
||||||
weights:
|
|
||||||
preprocess_index: -6
|
|
||||||
preprocess_query: -6
|
|
||||||
aggregated_field: { }
|
|
||||||
add_url: { }
|
add_url: { }
|
||||||
|
aggregated_field: { }
|
||||||
|
content_access:
|
||||||
|
weights:
|
||||||
|
preprocess_query: -30
|
||||||
|
entity_status: { }
|
||||||
html_filter:
|
html_filter:
|
||||||
all_fields: false
|
all_fields: false
|
||||||
fields:
|
fields:
|
||||||
@@ -192,11 +202,11 @@ processor_settings:
|
|||||||
title: true
|
title: true
|
||||||
alt: true
|
alt: true
|
||||||
tags:
|
tags:
|
||||||
|
b: 2
|
||||||
h1: 5
|
h1: 5
|
||||||
h2: 3
|
h2: 3
|
||||||
h3: 2
|
h3: 2
|
||||||
strong: 2
|
strong: 2
|
||||||
b: 2
|
|
||||||
weights:
|
weights:
|
||||||
preprocess_index: -15
|
preprocess_index: -15
|
||||||
preprocess_query: -15
|
preprocess_query: -15
|
||||||
@@ -204,40 +214,62 @@ processor_settings:
|
|||||||
all_fields: true
|
all_fields: true
|
||||||
fields:
|
fields:
|
||||||
- body
|
- body
|
||||||
- title
|
|
||||||
- field_description
|
- field_description
|
||||||
- field_transcript_trad
|
|
||||||
- field_transcript_vo
|
|
||||||
- name
|
|
||||||
- field_workflow
|
|
||||||
- field_genres
|
- field_genres
|
||||||
- field_langues
|
- field_langues
|
||||||
- field_synonyms
|
- field_synonyms
|
||||||
|
- field_transcript_trad
|
||||||
|
- field_transcript_vo
|
||||||
|
- field_workflow
|
||||||
|
- langcode
|
||||||
|
- language_with_fallback
|
||||||
|
- name
|
||||||
|
- title
|
||||||
weights:
|
weights:
|
||||||
preprocess_index: -20
|
preprocess_index: -20
|
||||||
preprocess_query: -20
|
preprocess_query: -20
|
||||||
|
language_with_fallback: { }
|
||||||
|
rendered_item: { }
|
||||||
|
reverse_entity_references: { }
|
||||||
|
tokenizer:
|
||||||
|
all_fields: true
|
||||||
|
fields:
|
||||||
|
- body
|
||||||
|
- field_description
|
||||||
|
- field_genres
|
||||||
|
- field_langues
|
||||||
|
- field_synonyms
|
||||||
|
- field_transcript_trad
|
||||||
|
- field_transcript_vo
|
||||||
|
- name
|
||||||
|
- title
|
||||||
|
spaces: ''
|
||||||
|
overlap_cjk: 1
|
||||||
|
minimum_word_size: '3'
|
||||||
|
weights:
|
||||||
|
preprocess_index: -6
|
||||||
|
preprocess_query: -6
|
||||||
transliteration:
|
transliteration:
|
||||||
all_fields: true
|
all_fields: true
|
||||||
fields:
|
fields:
|
||||||
- body
|
- body
|
||||||
- title
|
|
||||||
- field_description
|
- field_description
|
||||||
- field_transcript_trad
|
|
||||||
- field_transcript_vo
|
|
||||||
- name
|
|
||||||
- field_workflow
|
|
||||||
- field_genres
|
- field_genres
|
||||||
- field_langues
|
- field_langues
|
||||||
- field_synonyms
|
- field_synonyms
|
||||||
|
- field_transcript_trad
|
||||||
|
- field_transcript_vo
|
||||||
|
- field_workflow
|
||||||
|
- langcode
|
||||||
|
- language_with_fallback
|
||||||
|
- name
|
||||||
|
- title
|
||||||
weights:
|
weights:
|
||||||
preprocess_index: -20
|
preprocess_index: -20
|
||||||
preprocess_query: -20
|
preprocess_query: -20
|
||||||
content_access:
|
|
||||||
weights:
|
|
||||||
preprocess_query: -30
|
|
||||||
tracker_settings:
|
tracker_settings:
|
||||||
default:
|
default:
|
||||||
indexing_order: fifo
|
indexing_order: lifo
|
||||||
options:
|
options:
|
||||||
index_directly: true
|
index_directly: true
|
||||||
cron_limit: 50
|
cron_limit: 50
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
(function($,Drupal,drupalSettings){EdlpCorpus=function(){var _activated=true;var _$body=$('body');var _$container=_$body;var _$canvas=$('<canvas id="corpus-map">').appendTo(_$container);var _canvas=_$canvas[0];var _ctx=_canvas.getContext('2d');var _dpi=window.devicePixelRatio;var _scene_props={width:window.innerWidth,height:window.innerHeight,'margin_top':75,'margin_right':0,'margin_bottom':65,'margin_left':0};var _evolution_zone={left:_scene_props.width/4,right:_scene_props.width-_scene_props.width/4,center:_scene_props.width/2,};var _physics=new Physics();var _nodes=[];var _articles_nodes=[];var _no_articles_nodes=[];var _nodes_by_entries={};var _nodes_by_nid={};var _nodes_Nid_Id={};var _nodes_centered=[];var _nodes_centered_attractions=[];var _loaded=false;var _playlist=[];var _p_velocity_factor=0.5;var _mouse_in=true;var _m_pos={x:0,y:0};var _node_hover_id=-1;var _node_opened_id=-1;var _$entrees_block=$('#block-edlpentreesblock');var _$entrees_block_termlinks=$('a.term-link',_$entrees_block);var _$articles_link;var _node_pop_up;var _settings=drupalSettings.edlp_corpus;var _ecolors=_settings.colors;var _attracter;var check_parts_colid_frq=2;var check_parts_colid_tick=1;function init(){initCanvas();if(_activated){loadCorpus();}else{_$canvas.addClass('de-activated');}};function initCanvas(){window.addEventListener('resize',onResizeCanvas,false);onResizeCanvas();};function onResizeCanvas(){_scene_props.width=window.innerWidth;_scene_props.height=window.innerHeight;_canvas.style.width=_scene_props.width+'px';_canvas.style.height=_scene_props.height+'px';_canvas.width=_scene_props.width*_dpi;_canvas.height=_scene_props.height*_dpi;_ctx.scale(_dpi,_dpi);moveEvolutionZone();if(_loaded){for(var i=0;i<_nodes.length;i++){_nodes[i].onResizeCanvas();}}};function loadCorpus(){var ajax_path=_settings.load_corpus_ajax_url;var path=window.location.origin+Drupal.url(ajax_path);$.getJSON(path,{}).done(function(data){onCorpusLoaded(data);}).fail(function(jqxhr,textStatus,error){onCorpusLoadError(jqxhr,textStatus,error);});};function onCorpusLoadError(jqxhr,textStatus,error){void 0;};function onCorpusLoaded(data){void 0;initPhysics();buildNodes(data.nodes);initArtilesLink();initNodePopup();initEvents();checkPreOpenedEntry();startAnime();_loaded=true;};function initPhysics(){_attracter=_physics.makeParticle(1000);_attracter.fixed=true;resizePhysics();};function resizePhysics(){if(typeof _attracter!='undefined'){_attracter.position={x:_evolution_zone.center,y:_scene_props.height/2};}};function buildNodes(nodes){var d;for(var i in nodes){d=i<1?true:false;new Node(i,nodes[i],d);_playlist.push({'id':i,'nid':nodes[i].nid,'audio_url':nodes[i].audio_url,'document_url':nodes[i].document_url,});}};function Node(i,node,d){this.id=i;for(key in node)
|
(function($,Drupal,drupalSettings){EdlpCorpus=function(){var _activated=false;var _$body=$('body');var _$container=_$body;var _$canvas=$('<canvas id="corpus-map">').appendTo(_$container);var _canvas=_$canvas[0];var _ctx=_canvas.getContext('2d');var _dpi=window.devicePixelRatio;var _scene_props={width:window.innerWidth,height:window.innerHeight,'margin_top':75,'margin_right':0,'margin_bottom':65,'margin_left':0};var _evolution_zone={left:_scene_props.width/4,right:_scene_props.width-_scene_props.width/4,center:_scene_props.width/2,};var _physics=new Physics();var _nodes=[];var _articles_nodes=[];var _no_articles_nodes=[];var _nodes_by_entries={};var _nodes_by_nid={};var _nodes_Nid_Id={};var _nodes_centered=[];var _nodes_centered_attractions=[];var _loaded=false;var _playlist=[];var _p_velocity_factor=0.5;var _mouse_in=true;var _m_pos={x:0,y:0};var _node_hover_id=-1;var _node_opened_id=-1;var _$entrees_block=$('#block-edlpentreesblock');var _$entrees_block_termlinks=$('a.term-link',_$entrees_block);var _$articles_link;var _node_pop_up;var _settings=drupalSettings.edlp_corpus;var _ecolors=_settings.colors;var _attracter;var check_parts_colid_frq=2;var check_parts_colid_tick=1;function init(){initCanvas();if(_activated){loadCorpus();}else{_$canvas.addClass('de-activated');}};function initCanvas(){window.addEventListener('resize',onResizeCanvas,false);onResizeCanvas();};function onResizeCanvas(){_scene_props.width=window.innerWidth;_scene_props.height=window.innerHeight;_canvas.style.width=_scene_props.width+'px';_canvas.style.height=_scene_props.height+'px';_canvas.width=_scene_props.width*_dpi;_canvas.height=_scene_props.height*_dpi;_ctx.scale(_dpi,_dpi);moveEvolutionZone();if(_loaded){for(var i=0;i<_nodes.length;i++){_nodes[i].onResizeCanvas();}}};function loadCorpus(){var ajax_path=_settings.load_corpus_ajax_url;var path=window.location.origin+Drupal.url(ajax_path);$.getJSON(path,{}).done(function(data){onCorpusLoaded(data);}).fail(function(jqxhr,textStatus,error){onCorpusLoadError(jqxhr,textStatus,error);});};function onCorpusLoadError(jqxhr,textStatus,error){void 0;};function onCorpusLoaded(data){void 0;initPhysics();buildNodes(data.nodes);initArtilesLink();initNodePopup();initEvents();checkPreOpenedEntry();startAnime();_loaded=true;};function initPhysics(){_attracter=_physics.makeParticle(1000);_attracter.fixed=true;resizePhysics();};function resizePhysics(){if(typeof _attracter!='undefined'){_attracter.position={x:_evolution_zone.center,y:_scene_props.height/2};}};function buildNodes(nodes){var d;for(var i in nodes){d=i<1?true:false;new Node(i,nodes[i],d);_playlist.push({'id':i,'nid':nodes[i].nid,'audio_url':nodes[i].audio_url,'document_url':nodes[i].document_url,});}};function Node(i,node,d){this.id=i;for(key in node)
|
||||||
this[key]=node[key];_nodes.push(this);_nodes_by_nid[this.nid]=this;_nodes_Nid_Id[this.nid]=this.id;if(this.has_article==1){_articles_nodes.push(this);}else{_no_articles_nodes.push(this);}
|
this[key]=node[key];_nodes.push(this);_nodes_by_nid[this.nid]=this;_nodes_Nid_Id[this.nid]=this.id;if(this.has_article==1){_articles_nodes.push(this);}else{_no_articles_nodes.push(this);}
|
||||||
for(var j=0;j<this.entrees.length;j++){if(typeof _nodes_by_entries[this.entrees[j]]=='undefined')
|
for(var j=0;j<this.entrees.length;j++){if(typeof _nodes_by_entries[this.entrees[j]]=='undefined')
|
||||||
_nodes_by_entries[this.entrees[j]]=[];_nodes_by_entries[this.entrees[j]].push(this);}
|
_nodes_by_entries[this.entrees[j]]=[];_nodes_by_entries[this.entrees[j]].push(this);}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
(function($, Drupal, drupalSettings) {
|
(function($, Drupal, drupalSettings) {
|
||||||
|
|
||||||
EdlpCorpus = function(){
|
EdlpCorpus = function(){
|
||||||
var _activated = true;
|
var _activated = false;
|
||||||
var _$body = $('body');
|
var _$body = $('body');
|
||||||
var _$container = _$body;
|
var _$container = _$body;
|
||||||
var _$canvas = $('<canvas id="corpus-map">').appendTo(_$container);
|
var _$canvas = $('<canvas id="corpus-map">').appendTo(_$container);
|
||||||
|
|||||||
@@ -150,10 +150,14 @@ class EdlpSearchController extends ControllerBase {
|
|||||||
$query->addConditionGroup($wf_condition_group);
|
$query->addConditionGroup($wf_condition_group);
|
||||||
|
|
||||||
// Search for keys.
|
// Search for keys.
|
||||||
if (!empty($this->keys)) {
|
if (!empty($this->keys)) { // && strlen($this->keys) > 2
|
||||||
// dpm($this->keys);
|
// dpm($this->keys);
|
||||||
$query->keys($this->keys);
|
$query->keys($this->keys);
|
||||||
}
|
}
|
||||||
|
// else{
|
||||||
|
// $this->matches = [];
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
if(null !== $this->field_synonyms){
|
if(null !== $this->field_synonyms){
|
||||||
@@ -167,6 +171,7 @@ class EdlpSearchController extends ControllerBase {
|
|||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
$items = $result->getResultItems();
|
$items = $result->getResultItems();
|
||||||
// dpm($items);
|
// dpm($items);
|
||||||
|
|
||||||
$this->matches = [];
|
$this->matches = [];
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
// get the field from item
|
// get the field from item
|
||||||
@@ -185,6 +190,7 @@ class EdlpSearchController extends ControllerBase {
|
|||||||
// dpm($fields);
|
// dpm($fields);
|
||||||
// get field content
|
// get field content
|
||||||
$field_text = $fields[0]->getText();
|
$field_text = $fields[0]->getText();
|
||||||
|
// $entity_id = $fields[0]->get('tid');
|
||||||
|
|
||||||
// if content already in matches, skip item
|
// if content already in matches, skip item
|
||||||
if( in_array($field_text, $this->matches) ){
|
if( in_array($field_text, $this->matches) ){
|
||||||
@@ -192,6 +198,7 @@ class EdlpSearchController extends ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add the item to the return list
|
// add the item to the return list
|
||||||
|
// $matches_names = $field_text . '('.$entity_id.')';
|
||||||
$this->matches[] = $field_text;
|
$this->matches[] = $field_text;
|
||||||
|
|
||||||
// do not return more than 14 items
|
// do not return more than 14 items
|
||||||
@@ -250,7 +257,6 @@ class EdlpSearchController extends ControllerBase {
|
|||||||
|
|
||||||
$response = new JsonResponse();
|
$response = new JsonResponse();
|
||||||
$response->setData([
|
$response->setData([
|
||||||
'test'=>'search results',
|
|
||||||
'keys'=>$this->keys,
|
'keys'=>$this->keys,
|
||||||
'entries' => $this->entries,
|
'entries' => $this->entries,
|
||||||
'entry_names' => $this->entry_names,
|
'entry_names' => $this->entry_names,
|
||||||
@@ -308,8 +314,12 @@ class EdlpSearchController extends ControllerBase {
|
|||||||
$parse_mode = \Drupal::getContainer()
|
$parse_mode = \Drupal::getContainer()
|
||||||
->get('plugin.manager.search_api.parse_mode')
|
->get('plugin.manager.search_api.parse_mode')
|
||||||
->createInstance('direct');
|
->createInstance('direct');
|
||||||
|
// $parse_mode->setConjunction('AND');
|
||||||
$query->setParseMode($parse_mode);
|
$query->setParseMode($parse_mode);
|
||||||
|
|
||||||
|
// search in both languages (if not conditions will not work)
|
||||||
|
$query->setLanguages(array('fr','en'));
|
||||||
|
|
||||||
// workflow
|
// workflow
|
||||||
$wf_condition_group = $query->createConditionGroup('OR');
|
$wf_condition_group = $query->createConditionGroup('OR');
|
||||||
$wf_condition_group->addCondition('field_workflow', 'corpus_documents_publie', "=");
|
$wf_condition_group->addCondition('field_workflow', 'corpus_documents_publie', "=");
|
||||||
@@ -335,6 +345,8 @@ class EdlpSearchController extends ControllerBase {
|
|||||||
$query->addCondition('field_genres', $this->genres, "=");
|
$query->addCondition('field_genres', $this->genres, "=");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: locuteurs
|
||||||
|
|
||||||
// entries
|
// entries
|
||||||
$this->entry_names = [];
|
$this->entry_names = [];
|
||||||
if (!empty($this->entries)){
|
if (!empty($this->entries)){
|
||||||
@@ -348,15 +360,6 @@ class EdlpSearchController extends ControllerBase {
|
|||||||
$query->addConditionGroup($entries_condition_group);
|
$query->addConditionGroup($entries_condition_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: locuteurs
|
|
||||||
|
|
||||||
$current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
|
||||||
$query->setLanguages(array($current_langcode));
|
|
||||||
|
|
||||||
// $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
|
||||||
// // $language = \Drupal::languageManager()->getCurrentLanguage()->getName();
|
|
||||||
// $query->addCondition('search_api_language', $language);
|
|
||||||
|
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
$items = $result->getResultItems();
|
$items = $result->getResultItems();
|
||||||
// dpm($items);
|
// dpm($items);
|
||||||
|
|||||||
Reference in New Issue
Block a user