示例#1
0
        public override ResponseMessage Execute(RequestMessage request)
        {
            CountMatchQueryResponse result = new CountMatchQueryResponse();
            CountMatchQuery         query  = request as CountMatchQuery;

            if (query == null)
            {
                return(new ErrorResponse("Only CountMatch query please!"));
            }

            result.NumMatches = QueryDriver.DoCountMatchQuery(query);
            return(result);
        }
示例#2
0
        ////////////////////////////////////////////////////////

        static public int DoCountMatchQuery(CountMatchQuery query)
        {
            DehumanizeQuery(query);

            int num_matches = 0;

            try {
                iqueryable_lock.AcquireReaderLock(System.Threading.Timeout.Infinite);

                foreach (Queryable q in Queryables)
                {
                    if (!q.AcceptQuery(query))
                    {
                        continue;
                    }

                    num_matches += q.DoCountMatchQuery(query);
                }
            } finally {
                iqueryable_lock.ReleaseReaderLock();
            }

            return(num_matches);
        }
示例#3
0
		////////////////////////////////////////////////////////

		static public int DoCountMatchQuery (CountMatchQuery query)
		{
			DehumanizeQuery (query);

			int num_matches = 0;

			try {
				iqueryable_lock.AcquireReaderLock (System.Threading.Timeout.Infinite);

				foreach (Queryable q in Queryables) {
					if (! q.AcceptQuery (query))
						continue;

					num_matches += q.DoCountMatchQuery (query);
				}
			} finally {
				iqueryable_lock.ReleaseReaderLock ();
			}

			return num_matches;
		}