Exemplo n.º 1
0
        private MemberSearchQuery GetDataQuery(HttpContext context)
        {
            MemberSearchQuery memberSearchQuery = new MemberSearchQuery();

            memberSearchQuery.LastConsumeTime        = base.GetParameter(context, "LastConsumeTime", true);
            memberSearchQuery.CustomConsumeStartTime = base.GetParameter(context, "CustomConsumeStartTime", false);
            memberSearchQuery.CustomConsumeEndTime   = base.GetParameter(context, "CustomConsumeEndTime", false);
            memberSearchQuery.ConsumeTimes           = base.GetParameter(context, "ConsumeTimes", false);
            memberSearchQuery.CustomStartTimes       = base.GetIntParam(context, "CustomStartTimes", true);
            memberSearchQuery.CustomEndTimes         = base.GetIntParam(context, "CustomEndTimes", true);
            memberSearchQuery.ConsumePrice           = base.GetParameter(context, "ConsumePrice", false);
            memberSearchQuery.CustomStartPrice       = base.GetParameter(context, "CustomStartPrice", (decimal?)null);
            memberSearchQuery.CustomEndPrice         = base.GetParameter(context, "CustomEndPrice", (decimal?)null);
            memberSearchQuery.OrderAvgPrice          = base.GetParameter(context, "OrderAvgPrice", false);
            memberSearchQuery.CustomStartAvgPrice    = base.GetParameter(context, "CustomStartAvgPrice", (decimal?)null);
            memberSearchQuery.CustomEndAvgPrice      = base.GetParameter(context, "CustomEndAvgPrice", (decimal?)null);
            memberSearchQuery.ProductCategory        = base.GetParameter(context, "ProductCategory", false);
            memberSearchQuery.MemberTag                = base.GetParameter(context, "MemberTag", false);
            memberSearchQuery.UserGroupType            = base.GetParameter(context, "UserGroupType", false);
            memberSearchQuery.PageIndex                = base.CurrentPageIndex;
            memberSearchQuery.PageSize                 = base.CurrentPageSize;
            memberSearchQuery.ConsumeTimesInOneMonth   = base.CurrentSiteSetting.ConsumeTimesInOneMonth;
            memberSearchQuery.ConsumeTimesInThreeMonth = base.CurrentSiteSetting.ConsumeTimesInThreeMonth;
            memberSearchQuery.ConsumeTimesInSixMonth   = base.CurrentSiteSetting.ConsumeTimesInSixMonth;
            return(memberSearchQuery);
        }
Exemplo n.º 2
0
 public IEnumerable <BrowseSelection> GetSelections(MemberSearchQuery query)
 {
     return(from h in _handlers
            let s = h.GetSelection(query)
                    where s != null
                    select s);
 }
Exemplo n.º 3
0
 Sort IContentHandler.GetSort(MemberSearchQuery searchQuery)
 {
     return(new Sort(new[]
     {
         new SortField(FieldName.FirstName, SortField.STRING, searchQuery.ReverseSortOrder),
         new SortField(FieldName.LastName, SortField.STRING, searchQuery.ReverseSortOrder)
     }));
 }
Exemplo n.º 4
0
 Sort IContentHandler.GetSort(MemberSearchQuery searchQuery)
 {
     return(new Sort(new[]
     {
         new SortField(FieldName.CandidateStatus, SortField.INT, !searchQuery.ReverseSortOrder),
         SortField.FIELD_SCORE
     }));
 }
Exemplo n.º 5
0
        private void GetList(HttpContext context)
        {
            MemberSearchQuery dataQuery = this.GetDataQuery(context);
            DataGridViewModel <Dictionary <string, object> > listSplittinDraws = this.GetListSplittinDraws(dataQuery);
            string s = base.SerializeObjectToJson(listSplittinDraws);

            context.Response.Write(s);
            context.Response.End();
        }
Exemplo n.º 6
0
        public void FilterByRegionHobart()
        {
            var memberQuery = new MemberSearchQuery {
                Location = _hobart
            };
            var results = Search(memberQuery);

            Assert.AreEqual(0, results.Length);
        }
Exemplo n.º 7
0
        public void FilterByRegionMelbourne()
        {
            var memberQuery = new MemberSearchQuery {
                Location = _melbourne
            };
            var results = Search(memberQuery);

            CollectionAssert.AreEquivalent(new[] { _zero, _three }, results);
        }
Exemplo n.º 8
0
        public void FilterByStateQueensland()
        {
            var memberQuery = new MemberSearchQuery {
                Location = _queensland
            };
            var results = Search(memberQuery);

            Assert.AreEqual(0, results.Length);
        }
Exemplo n.º 9
0
        public void FilterByStateTasmania()
        {
            var memberQuery = new MemberSearchQuery {
                Location = _tasmania
            };
            var results = Search(memberQuery);

            Assert.AreEqual(0, results.Length);
        }
Exemplo n.º 10
0
        public void FilterByStateVictoria()
        {
            var memberQuery = new MemberSearchQuery {
                Location = _victoria
            };
            var results = Search(memberQuery);

            CollectionAssert.AreEquivalent(new[] { _zero, _three, _four }, results);
        }
Exemplo n.º 11
0
        private MemberSearchResults Search(MemberSearchQuery memberQuery, int skip, int take)
        {
            var searcher      = new Searcher(_indexWriter.getReader());
            var query         = _indexer.GetQuery(memberQuery);
            var sort          = _indexer.GetSort(null, memberQuery);
            var searchResults = searcher.Search(query, null, null, sort.getSort(), skip, take, false);

            return(searchResults);
        }
Exemplo n.º 12
0
        public LuceneQuery GetQuery(MemberSearchQuery searchQuery)
        {
            var fieldQueries = CreateFieldQueries(searchQuery);
            var query        = fieldQueries.CombineQueries(BooleanClause.Occur.MUST) ?? new MatchAllDocsQuery();

            return(searchQuery.SortOrder == MemberSortOrder.Relevance
                ? _booster.GetRecencyBoostingQuery(query)
                : query);
        }
Exemplo n.º 13
0
        public void SortByNameTest()
        {
            // Create content.

            //Visibilty needs to be name and resume to allow indexing
            const ProfessionalVisibility visibility = ProfessionalVisibility.Name | ProfessionalVisibility.Resume;

            var bx     = Guid.NewGuid();
            var member = new Member {
                Id = bx, FirstName = "b", LastName = "x"
            };

            member.VisibilitySettings.Professional.EmploymentVisibility = visibility;
            IndexContent(new MemberContent {
                Member = member, Candidate = new Candidate()
            });

            var ax = Guid.NewGuid();

            member = new Member {
                Id = ax, FirstName = "A", LastName = "x"
            };
            member.VisibilitySettings.Professional.EmploymentVisibility = visibility;
            IndexContent(new MemberContent {
                Member = member, Candidate = new Candidate()
            });

            var ay = Guid.NewGuid();

            member = new Member {
                Id = ay, FirstName = "a", LastName = "Y"
            };
            member.VisibilitySettings.Professional.EmploymentVisibility = visibility;
            IndexContent(new MemberContent {
                Member = member, Candidate = new Candidate()
            });


            // Ascending order.

            var searchQuery = new MemberSearchQuery {
                SortOrder = MemberSortOrder.FirstName, ReverseSortOrder = false
            };
            var searchResults = Search(searchQuery, 0, 10);

            CollectionAssert.AreEqual(new[] { ax, ay, bx }, searchResults.MemberIds.ToArray());

            // Descending order.

            searchQuery = new MemberSearchQuery {
                SortOrder = MemberSortOrder.FirstName, ReverseSortOrder = true
            };
            searchResults = Search(searchQuery, 0, 10);
            CollectionAssert.AreEqual(new[] { bx, ay, ax }, searchResults.MemberIds.ToArray());
        }
Exemplo n.º 14
0
        LuceneFilter IContentHandler.GetFilter(MemberSearchQuery searchQuery)
        {
            if (searchQuery.Recency == null)
            {
                return(null);
            }

            var modifiedSince = DateTime.Now - searchQuery.Recency.Value;

            return(GetFilter(modifiedSince));
        }
Exemplo n.º 15
0
        public void SortByCandidateStatusTest()
        {
            // Create content.

            var activelyLooking = Guid.NewGuid();
            var content         = new MemberContent {
                Member = new Member {
                    Id = activelyLooking
                }, Candidate = new Candidate {
                    Status = CandidateStatus.ActivelyLooking
                }
            };

            IndexContent(content);

            var availableNow = Guid.NewGuid();

            content = new MemberContent {
                Member = new Member {
                    Id = availableNow
                }, Candidate = new Candidate {
                    Status = CandidateStatus.AvailableNow
                }
            };
            IndexContent(content);

            var unspecified = Guid.NewGuid();

            content = new MemberContent {
                Member = new Member {
                    Id = unspecified
                }, Candidate = new Candidate {
                    Status = CandidateStatus.Unspecified
                }
            };
            IndexContent(content);

            // Default order.

            var memberQuery = new MemberSearchQuery {
                SortOrder = MemberSortOrder.Availability
            };
            var searchResults = Search(memberQuery, 0, 10);

            CollectionAssert.AreEqual(new[] { availableNow, activelyLooking, unspecified }, searchResults.MemberIds.ToArray());

            // Reverse order.

            memberQuery = new MemberSearchQuery {
                SortOrder = MemberSortOrder.Availability, ReverseSortOrder = true
            };
            searchResults = Search(memberQuery, 0, 10);
            CollectionAssert.AreEqual(new[] { unspecified, activelyLooking, availableNow }, searchResults.MemberIds.ToArray());
        }
Exemplo n.º 16
0
        protected MemberSearchResults Search(MemberSearchQuery memberQuery, int skip, int take)
        {
            var searcher      = new Searcher(_indexWriter.getReader());
            var query         = _indexer.GetQuery(memberQuery);
            var filter        = _indexer.GetFilter(memberQuery, null, null);
            var selections    = _indexer.GetSelections(memberQuery);
            var sort          = _indexer.GetSort(null, memberQuery);
            var searchResults = searcher.Search(query, filter, selections, sort == null ? null : sort.getSort(), skip, take, true);

            return(searchResults);
        }
Exemplo n.º 17
0
        public void FilterByRegionRelocateToLocality()
        {
            var memberQuery = new MemberSearchQuery
            {
                Location          = _melbourne,
                IncludeRelocating = true
            };

            var results = Search(memberQuery);

            CollectionAssert.AreEquivalent(new[] { _zero, _one, _three }, results);
        }
Exemplo n.º 18
0
        LuceneFilter IContentHandler.GetFilter(MemberSearchQuery searchQuery)
        {
            if (searchQuery.HasResume == null)
            {
                return(null);
            }

            var filter = new TermsFilter();

            filter.addTerm(new Term(FieldName.HasResume, NumericUtils.intToPrefixCoded(searchQuery.HasResume.Value ? 1 : 0)));
            return(filter);
        }
Exemplo n.º 19
0
 private LuceneQuery[] CreateFieldQueries(MemberSearchQuery query)
 {
     return(new[]
     {
         BoostContentQuery(GetContentQuery(query), query),
         GetJobTitleQuery(query),
         GetEmployerQuery(query),
         GetDesiredJobTitleQuery(query),
         GetEducationQuery(query),
         GetNameQuery(query)
     });
 }
Exemplo n.º 20
0
        public void SortBySalaryTest()
        {
            // Create content.

            var noSalary = Guid.NewGuid();

            IndexContent(new MemberContent {
                Member = new Member {
                    Id = noSalary
                }, Candidate = new Candidate()
            });

            var cheap = Guid.NewGuid();

            IndexContent(new MemberContent {
                Member = new Member {
                    Id = cheap
                }, Candidate = new Candidate {
                    DesiredSalary = new Salary {
                        LowerBound = 40000, UpperBound = null, Currency = Currency.AUD, Rate = SalaryRate.Year
                    }
                }
            });

            var expensive = Guid.NewGuid();

            IndexContent(new MemberContent {
                Member = new Member {
                    Id = expensive
                }, Candidate = new Candidate {
                    DesiredSalary = new Salary {
                        LowerBound = 200000, UpperBound = null, Currency = Currency.AUD, Rate = SalaryRate.Year
                    }
                }
            });

            // Default order.

            var searchQuery = new MemberSearchQuery {
                SortOrder = MemberSortOrder.Salary
            };
            var searchResults = Search(searchQuery, 0, 10);

            CollectionAssert.AreEqual(new[] { expensive, cheap, noSalary }, searchResults.MemberIds.ToArray());

            // Reverse order.

            searchQuery = new MemberSearchQuery {
                SortOrder = MemberSortOrder.Salary, ReverseSortOrder = true
            };
            searchResults = Search(searchQuery, 0, 10);
            CollectionAssert.AreEqual(new[] { cheap, expensive, noSalary }, searchResults.MemberIds.ToArray());
        }
Exemplo n.º 21
0
        LuceneFilter IContentHandler.GetFilter(MemberSearchQuery searchQuery)
        {
            // Convert to yearly to standardise search.

            var salary = searchQuery.Salary;

            if (salary != null)
            {
                salary = salary.ToRate(SalaryRate.Year);
            }
            return(GetFilter(salary, searchQuery.ExcludeNoSalary));
        }
Exemplo n.º 22
0
        LuceneFilter IContentHandler.GetFilter(MemberSearchQuery searchQuery)
        {
            if (searchQuery.CommunityId == null)
            {
                return(null);
            }

            var filter = new TermsFilter();

            filter.addTerm(new Term(FieldName.Community, searchQuery.CommunityId.Value.ToFieldValue()));
            return(filter);
        }
Exemplo n.º 23
0
        public void FilterByRegionRelocateToCountrySubdivison()
        {
            var memberQuery = new MemberSearchQuery
            {
                Location          = _hobart,
                IncludeRelocating = true
            };

            var results = Search(memberQuery);

            CollectionAssert.AreEquivalent(new[] { _one, _three }, results);
        }
Exemplo n.º 24
0
        public void FilterByStateRelocateToRegion()
        {
            var memberQuery = new MemberSearchQuery
            {
                Location          = _queensland,
                IncludeRelocating = true
            };

            var results = Search(memberQuery);

            CollectionAssert.AreEquivalent(new[] { _three, _four }, results);
        }
Exemplo n.º 25
0
        public void FilterByRegionRelocateToSearchedRegion()
        {
            var memberQuery = new MemberSearchQuery
            {
                Location          = _goldCoast,
                IncludeRelocating = true
            };

            var results = Search(memberQuery);

            CollectionAssert.AreEquivalent(new[] { _three, _four }, results);
        }
Exemplo n.º 26
0
        private LuceneQuery BoostContentQuery(LuceneQuery contentQuery, MemberSearchQuery query)
        {
            if (contentQuery == null || query.SortOrder != MemberSortOrder.Relevance)
            {
                return(contentQuery);
            }

            // Boost recent job titles.

            var jobTitleQuery = query.Keywords.GetLuceneBoostQuery(query.IncludeSynonyms ? FieldName.JobTitleRecent : FieldName.JobTitleRecent_Exact, _queryAnalyzer);

            return(_booster.GetJobTitleBoostingQuery(contentQuery, jobTitleQuery));
        }
Exemplo n.º 27
0
        public void FilterByLocalityRelocateToLocality()
        {
            var memberQuery = new MemberSearchQuery
            {
                Location          = _nearArmadale,
                Distance          = 5,
                IncludeRelocating = true
            };

            var results = Search(memberQuery);

            CollectionAssert.AreEquivalent(new[] { _zero, _one, _three }, results);
        }
Exemplo n.º 28
0
        public void FilterByLocalityRelocateToCountrySubdivision()
        {
            var memberQuery = new MemberSearchQuery
            {
                Location          = _devonport,
                Distance          = 5,
                IncludeRelocating = true
            };

            var results = Search(memberQuery);

            CollectionAssert.AreEquivalent(new[] { _one, _three }, results);
        }
Exemplo n.º 29
0
        private static Guid[] Search(MemberSearchQuery memberQuery)
        {
            var query  = _indexer.GetQuery(memberQuery);
            var filter = _indexer.GetFilter(memberQuery, null, null);

            var hits = _indexSearcher.search(query, filter, 10);

            return(Array.ConvertAll(hits.scoreDocs, scoreDoc =>
            {
                var document = _indexSearcher.doc(scoreDoc.doc);
                return new Guid(document.get(SearchFieldName.Id));
            }));
        }
Exemplo n.º 30
0
        public LuceneQuery GetNameQuery(MemberSearchQuery query)
        {
            if (string.IsNullOrEmpty(query.Name))
            {
                return(null);
            }

            var fieldName   = query.IncludeSimilarNames ? FieldName.Name : FieldName.Name_Exact;
            var queryParser = new QueryParser(LuceneVersion.LUCENE_29, fieldName, _queryAnalyzer);

            queryParser.setDefaultOperator(QueryParser.Operator.AND);

            return(queryParser.parse(query.Name));
        }