Пример #1
0
        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="rootDirectory">
        ///     must exist
        /// </param>
        /// <param name="entityAdapter">
        /// </param>
        /// <param name="multiIndex">
        ///     Implements collection of named <see cref="ILuceneIndex"/> used in parallel for e.g. multi-lingual search.
        /// </param>
        public SearchEngine(string rootDirectory, ILuceneEntityAdapter <TDoc, THeader, TStorageKey> entityAdapter, IMultiIndex multiIndex)
        {
            Check.DoRequireArgumentNotBlank(rootDirectory, nameof(rootDirectory));
            Check.DoRequireArgumentNotNull(entityAdapter, nameof(entityAdapter));
            Check.DoRequireArgumentNotNull(multiIndex, nameof(multiIndex));

            Check.DoCheckArgument(Directory.Exists(rootDirectory), "Root directory does not exist");

            RootDirectory = rootDirectory;
            EntityAdapter = entityAdapter;
            MultiIndex    = multiIndex;
        }
Пример #2
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            connection.RunAsync(Query.DbCreate("test")).Wait();
            connection.RunAsync(Query.Db("test").TableCreate("table1")).Wait();
            connection.RunAsync(Query.Db("test").TableCreate("table2")).Wait();

            testTable        = Query.Db("test").Table <TestObject>("table1");
            anotherTestTable = Query.Db("test").Table <AnotherTestObject>("table2");

            firstNameIndex = anotherTestTable.IndexDefine("index1", o => o.FirstName);
            connection.Run(firstNameIndex.IndexCreate());
            connection.Run(firstNameIndex.IndexWait());

            tagsIndex = testTable.IndexDefineMulti("indexTags", o => o.Tags);
            connection.Run(tagsIndex.IndexCreate());
            connection.Run(tagsIndex.IndexWait());
        }
Пример #3
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            connection.RunAsync(Query.DbCreate("test")).Wait();
            connection.RunAsync(Query.Db("test").TableCreate("table1")).Wait();
            connection.RunAsync(Query.Db("test").TableCreate("table2")).Wait();

            testTable = Query.Db("test").Table<TestObject>("table1");
            anotherTestTable = Query.Db("test").Table<AnotherTestObject>("table2");

            firstNameIndex = anotherTestTable.IndexDefine("index1", o => o.FirstName);
            connection.Run(firstNameIndex.IndexCreate());
            connection.Run(firstNameIndex.IndexWait());

            tagsIndex = testTable.IndexDefineMulti("indexTags", o => o.Tags);
            connection.Run(tagsIndex.IndexCreate());
            connection.Run(tagsIndex.IndexWait());
        }
Пример #4
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            connection.RunAsync(Query.DbCreate("test")).Wait();
            connection.RunAsync(Query.Db("test").TableCreate("table1")).Wait();
            connection.RunAsync(Query.Db("test").TableCreate("table2")).Wait();

            testTable = Query.Db("test").Table<TestObject>("table1");
            anotherTestTable = Query.Db("test").Table<AnotherTestObject>("table2");

            firstNameIndex = anotherTestTable.IndexDefine("index1", o => o.FirstName);
            connection.Run(firstNameIndex.IndexCreate());
            connection.Run(firstNameIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed

            tagsIndex = testTable.IndexDefineMulti("indexTags", o => o.Tags);
            connection.Run(tagsIndex.IndexCreate());
            connection.Run(tagsIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed
        }
Пример #5
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            connection.RunAsync(Query.DbCreate("test")).Wait();
            connection.RunAsync(Query.Db("test").TableCreate("table1")).Wait();
            connection.RunAsync(Query.Db("test").TableCreate("table2")).Wait();

            testTable        = Query.Db("test").Table <TestObject>("table1");
            anotherTestTable = Query.Db("test").Table <AnotherTestObject>("table2");

            firstNameIndex = anotherTestTable.IndexDefine("index1", o => o.FirstName);
            connection.Run(firstNameIndex.IndexCreate());
            connection.Run(firstNameIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed

            tagsIndex = testTable.IndexDefineMulti("indexTags", o => o.Tags);
            connection.Run(tagsIndex.IndexCreate());
            connection.Run(tagsIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed
        }
Пример #6
0
 public static IndexCreateQuery <TRecord, IEnumerable <TIndex> > IndexCreate <TRecord, TIndex>(this IMultiIndex <TRecord, TIndex> index)
 {
     return(index.Table.IndexCreate(index.Name, index.IndexAccessor, true));
 }
Пример #7
0
 public static IWriteQuery <DmlResponse> IndexCreate <TRecord, TIndex>(this IMultiIndex <TRecord, TIndex> index)
 {
     return(index.Table.IndexCreate(index.Name, index.IndexAccessor, true));
 }