示例#1
0
        private NodeQueryResult ExecuteIndexedEngineQuery()
        {
            if (!StorageContext.Search.IsOuterEngineEnabled)
            {
                throw new InvalidOperationException("Outer indexing engine is not present or disabled.");
            }
            var idArray = IndexedSearchEngine.Execute(this);
            var result  = new NodeQueryResult(new NodeList <Node>(idArray));

            return(result);
        }
示例#2
0
        public void Indexing_1()
        {
            var trace = SenseNet.ContentRepository.Schema.ContentType.TracePerFieldIndexingInfo();
            var lucEngine = (LuceneSearchEngine)StorageContext.Search.SearchEngine;

            var nodeQuery1 = new NodeQuery(new StringExpression(StringAttribute.Name, StringOperator.Equal, "System"));
            var lucQueryText1 = "Name:System";
            var nqResult1 = nodeQuery1.Execute(ExecutionHint.ForceRelationalEngine);
            var lqResult1 = new NodeQueryResult(new NodeList<Node>(lucEngine.Execute(lucQueryText1)));

            var id = Node.LoadNode("/Root/System").Id;

            var nodeQuery3 = new NodeQuery(new IntExpression(IntAttribute.Id, ValueOperator.Equal, id));
            var lucQueryText3 = "Id:" + id;
            var nqResult3 = nodeQuery3.Execute(ExecutionHint.ForceRelationalEngine);
            var lqResult3 = new NodeQueryResult(new NodeList<Node>(lucEngine.Execute(lucQueryText3)));

            //Assert.IsTrue(CompareResults(nqResult1, lqResult1), "Results#1 are not equal");
            Assert.IsTrue(CompareResults(nqResult3, lqResult3), "Results#3 are not equal");
        }