Ejemplo n.º 1
0
        private IEnumerable <DocumentId> ExecuteNot(BooleanQueryOperationNot op)
        {
            var docs = ExecuteQuery(op.Element).GetEnumerator();
            var all  = index.GetAll().GetEnumerator();

            if (!all.MoveNext())
            {
                yield break;
            }

            while (docs.MoveNext())
            {
                while (all.Current.CompareTo(docs.Current) < 0)
                {
                    yield return(all.Current);

                    if (!all.MoveNext())
                    {
                        yield break;
                    }
                }

                if (!all.MoveNext())
                {
                    yield break;
                }
            }

            do
            {
                yield return(all.Current);
            }while (all.MoveNext());
        }
Ejemplo n.º 2
0
        protected void AssertIndices(ISearchableIndex <string> expected, ISearchableIndex <string> actual)
        {
            foreach (var word in IndexHelper.Results.Keys)
            {
                Assert.Equal(expected.Search(word), actual.Search(word));
                Assert.Equal(expected.GetCount(word), actual.GetCount(word));
            }

            Assert.Equal(expected.GetAll(), actual.GetAll());
            Assert.Equal(expected.GetCount(), actual.GetCount());
        }