Ejemplo n.º 1
0
        protected override string GetQueryFilter()
        {
            var originalQueryFilter = base.GetQueryFilter();

            if (SearchForm == null)
            {
                return(originalQueryFilter);
            }

            SearchForm.UpdateContent();

            DefaultQueryBuilder qBuilder;

            if (string.IsNullOrEmpty(PluginFullPath))
            {
                qBuilder = new DefaultQueryBuilder(originalQueryFilter, SearchForm.Content, EmptyQueryTerm);
            }
            else
            {
                qBuilder = TypeHandler.CreateInstance(PluginFullPath, new object[] { originalQueryFilter, SearchForm.Content }) as DefaultQueryBuilder;
            }

            var filter = qBuilder.BuildQuery(/*kv*/);

            var sb     = new StringBuilder();
            var writer = XmlWriter.Create(sb);

            writer.WriteStartDocument();
            writer.WriteStartElement("ContentMetaData");
            writer.WriteElementString("ContentType", SearchForm.Content.ContentType.Name);
            writer.WriteElementString("ContentName", SearchForm.Content.Name);
            writer.WriteStartElement("Fields");

            SearchForm.Content.ExportFieldData(writer, new ExportContext("/Root", ""));

            writer.WriteEndElement();
            writer.WriteEndElement();
            writer.Flush();
            writer.Close();

            _state.ExportQueryFields = sb.ToString();
            PortletState.Persist(_state);

            return(filter);
        }
Ejemplo n.º 2
0
        protected override string GetQueryFilter()
        {
            var originalQueryFilter = base.GetQueryFilter();
            if (SearchForm == null)
                return originalQueryFilter;

            SearchForm.UpdateContent();

            DefaultQueryBuilder qBuilder;
            if (string.IsNullOrEmpty(PluginFullPath))
                qBuilder = new DefaultQueryBuilder(originalQueryFilter, SearchForm.Content, EmptyQueryTerm);
            else
                qBuilder = TypeHandler.CreateInstance(PluginFullPath, new object[] {originalQueryFilter, SearchForm.Content}) as DefaultQueryBuilder;

            var filter = qBuilder.BuildQuery(/*kv*/);

            var sb = new StringBuilder();
            var writer = XmlWriter.Create(sb);

            writer.WriteStartDocument();
            writer.WriteStartElement("ContentMetaData");
            writer.WriteElementString("ContentType", SearchForm.Content.ContentType.Name);
            writer.WriteElementString("ContentName", SearchForm.Content.Name);
            writer.WriteStartElement("Fields");

            SearchForm.Content.ExportFieldData(writer, new ExportContext("/Root", ""));

            writer.WriteEndElement();
            writer.WriteEndElement();
            writer.Flush();
            writer.Close();

            _state.ExportQueryFields = sb.ToString();
            PortletState.Persist(_state);

            return filter;
        }