コード例 #1
0
        public IList <LuceneSearchResult> FindMatchingEventCandidates(DateTime?start, DateTime?end, string caseCode)
        {
            DatePeriodForSearch dateFilters = new DatePeriodForSearch(start, end);

            // search fields indexed by Lucene for mention of the case code, filtered by the above dates...
            return(this.EventSearch(caseCode, dateFilters.StartFilter, dateFilters.EndFilter, 50, "StartDateDisplay", true));
        }
コード例 #2
0
        public IList <LuceneSearchResult> FindMatchingEventCandidates(DateTime?start, DateTime?end, string caseCode,
                                                                      string townVillage, string subregion, string region)
        {
            // search Lucene fields filtered by date and case code...
            IList <LuceneSearchResult> candidates = this.FindMatchingEventCandidates(start, end, caseCode);

            DatePeriodForSearch dateFilters = new DatePeriodForSearch(start, end);

            // ...Town/Village
            IList <LuceneSearchResult> townCandidates = null;

            if (!string.IsNullOrEmpty(townVillage))
            {
                townCandidates = this.EventSearch(townVillage, dateFilters.StartFilter, dateFilters.EndFilter, 50, "StartDateDisplay", true);
            }
            if (townCandidates != null && townCandidates.Any())
            {
                candidates = candidates.Concat(townCandidates).ToList();
            }
            else
            {
                // ...Subregion
                IList <LuceneSearchResult> subregionCandidates = null;
                if (!string.IsNullOrEmpty(subregion))
                {
                    subregionCandidates = this.EventSearch(subregion, dateFilters.StartFilter, dateFilters.EndFilter, 50, "StartDateDisplay", true);
                }
                if (subregionCandidates != null && subregionCandidates.Any())
                {
                    candidates = candidates.Concat(subregionCandidates).ToList();
                }
                else
                {
                    // ...Region
                    IList <LuceneSearchResult> regionCandidates = null;
                    if (!string.IsNullOrEmpty(region))
                    {
                        regionCandidates = this.EventSearch(region, dateFilters.StartFilter, dateFilters.EndFilter, 50, "StartDateDisplay", true);
                    }
                    if (regionCandidates != null && regionCandidates.Any())
                    {
                        candidates = candidates.Concat(regionCandidates).ToList();
                    }
                }
            }

            return(candidates);
        }