Commit 8054dcdb authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade compatibilidad con RestManager

parent a3e208df
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -30,13 +30,15 @@ define([

		_setMainConfigurations: function() {

			var atlasSearchFields = ['title.suggest', 'alias.suggest', 'keywords.suggest'],
			var atlasHighlightFields = ['title.suggest', 'alias.suggest'],
				atlasSearchFields = ['title.suggest', 'alias.suggest', 'keywords.suggest'],
				atlasSuggestFields = ['title', 'alias', 'keywords'];

			this.textSearchConfig = this._merge([{
				highlightField: atlasSearchFields,
				highlightField: atlasHighlightFields,
				suggestFields: atlasSuggestFields,
				searchFields: atlasSearchFields
				searchFields: atlasSearchFields,
				legacyMode: false
			}, this.textSearchConfig || {}]);

			this.filterConfig = this._merge([{
@@ -73,6 +75,10 @@ define([

		_handleFilterParams: function(filterParams) {

			if (filterParams.suggest) {
				return;
			}

			this._requestAtlasData({
				target: this.target,
				queryParams: filterParams
+26 −15
Original line number Diff line number Diff line
@@ -41,10 +41,12 @@ define([
					SERIALIZED: "serialized"
				},
				methodSuggest: "POST",
				action: "_suggest",
				suggestAction: "_suggest",
				searchAction: "_search",
				itemLabel: null,
				textValue: '',
				ownChannel: "textSearch"
				ownChannel: "textSearch",
				legacyMode: true
			};

			lang.mixin(this, this.config, args);
@@ -125,22 +127,11 @@ define([
			});

			this._once(this._buildChannel(this.queryChannel, this.actions.SERIALIZED),
				lang.hitch(this, this._subSerialized, evt));
				lang.hitch(this, this._subSerialized, evt, this.suggestAction));

			this._publish(this._buildChannel(this.queryChannel, this.actions.SERIALIZE));
		},

		_subSerialized: function(evt, req) {

			this._emitEvt('REQUEST', {
				target: this._getTarget(),
				action: this.action,
				requesterId: this.getOwnChannel(),
				method: this.methodSuggest,
				query: req.data
			});
		},

		_subRequested: function(req) {

			var query = req.query,
@@ -188,7 +179,27 @@ define([

			this._emitEvt('SEARCH', {
				text: this._createQuery(evt),
				from: 0
				from: 0,
				omitRefresh: true
			});

			//Por retrocompatibilidad se debe llamar a _subSerialized
			if (this.legacyMode) {
				this._once(this._buildChannel(this.queryChannel, this.actions.SERIALIZED),
					lang.hitch(this, this._subSerialized, evt, this.searchAction));
			}

			this._publish(this._buildChannel(this.queryChannel, this.actions.SERIALIZE));
		},

		_subSerialized: function(evt, action, req) {

			this._emitEvt('REQUEST', {
				target: this._getTarget(),
				action: action,
				requesterId: this.getOwnChannel(),
				method: this.methodSuggest,
				query: req.data
			});
		},