Example #1
0
        public new string Search(string searchText)
        {
            string   operador = GISAUtils.buildOperatorSearchString(ref searchText);
            DateTime?inicio   = null;
            DateTime?fim      = null;

            searchText = GISAUtils.buildDataInicialDataFinalSearchString(searchText, out inicio, out fim);
            List <string> nivelIds = GISAUtils.GetNivelIds(operador, inicio, fim);

            List <string> luceneResults;

            if (nivelIds == null) //no parameter was actually filled for GetNivelIds()
            {
                luceneResults = base.Search(searchText);
            }
            else
            {
                if (nivelIds.Count > 0)
                {
                    if (searchText.Length > 0)
                    {
                        string a = GISAUtils.buildList_Id_OR_Id(searchText, nivelIds);
                        luceneResults = base.Search(a);
                    }
                    else
                    {
                        luceneResults = nivelIds;
                    }
                }
                else
                {
                    luceneResults = new List <string>();
                }
            }

            Dictionary <string, string> test = new Dictionary <string, string>();

            List <string> ret = new List <string>();

            foreach (string id in luceneResults)
            {
                if (test.ContainsKey(id))
                {
                    continue;
                }

                test.Add(id, id);
                ret.Add(id);
            }

            return(string.Join(" ", ret.ToArray()));
        }
        public string Search(string searchText, long idTrustee)
        {
            var results = this.queryCacher.SearchInCache(idTrustee, searchText);

            if (results != null)
            {
                return(string.Join(" ", results.ToArray()));
            }

            string   operador = GISAUtils.buildOperatorSearchString(ref searchText);
            DateTime?inicio;
            DateTime?fim;

            searchText = GISAUtils.buildDataInicialDataFinalSearchString(searchText, out inicio, out fim);
            List <string> nivelIds = GISAUtils.GetNivelIds(operador, inicio, fim);

            List <string> luceneResults;

            if (nivelIds == null) //no parameter was actually filled for GetNivelIds()
            {
                luceneResults = base.Search(searchText);
            }
            else
            {
                if (nivelIds.Count > 0)
                {
                    if (searchText.Length > 0)
                    {
                        string a = GISAUtils.buildList_Id_OR_Id(searchText, nivelIds);
                        luceneResults = base.Search(a);
                    }
                    else
                    {
                        luceneResults = nivelIds;
                    }
                }
                else
                {
                    luceneResults = new List <string>();
                }
            }

            var c   = DateTime.Now.Ticks;
            var ret = Util.FilterByReadPermission(luceneResults, idTrustee);
            var b   = new TimeSpan(DateTime.Now.Ticks - c).ToString();

            queryCacher.Add(idTrustee, searchText, luceneResults);

            return(string.Join(" ", ret.ToArray()));
        }
        public new string Search(string searchText)
        {
            string   operador = GISAUtils.buildOperatorSearchString(ref searchText);
            DateTime?inicio;
            DateTime?fim;

            searchText = GISAUtils.buildDataInicialDataFinalSearchString(searchText, out inicio, out fim);
            List <string> nivelIds = GISAUtils.GetNivelIds(operador, inicio, fim);

            List <string> luceneResults;

            if (nivelIds == null) //no parameter was actually filled for GetNivelIds()
            {
                luceneResults = base.Search(searchText);
            }
            else
            {
                if (nivelIds.Count > 0)
                {
                    if (searchText.Length > 0)
                    {
                        string a = GISAUtils.buildList_Id_OR_Id(searchText, nivelIds);
                        luceneResults = base.Search(a);
                    }
                    else
                    {
                        luceneResults = nivelIds;
                    }
                }
                else
                {
                    luceneResults = new List <string>();
                }
            }

            return(string.Join(" ", luceneResults.ToArray()));
        }