示例#1
0
 public override IEnumerable <object> Query(string propertyName, object propertyValue)
 {
     foreach (Document doc in LuceneIndex.Search(propertyName, propertyValue.ToString()))
     {
         yield return(doc.ToDynamicInstance(DynamicSearchResultTypeName));
     }
 }
示例#2
0
        public override bool Delete(Type type, object toDelete)
        {
            bool result = PerformDelete(type, toDelete);

            LuceneIndex.UnIndex(toDelete);
            return(result);
        }
示例#3
0
        public override object Create(Type type, object toCreate)
        {
            object result = PerformCreate(type, toCreate);

            LuceneIndex.Index(result);
            return(result);
        }
示例#4
0
        public override IEnumerable <object> Query(Type type, Dictionary <string, object> queryParameters)
        {
            List <Document> results = new List <Document>();

            Parallel.ForEach(queryParameters.Keys, key =>
            {
                results.AddRange(LuceneIndex.Search(key, queryParameters[key].ToString()));
            });
            return(results.Select(d => d.ToDynamicInstance(DynamicSearchResultTypeName)));
        }
示例#5
0
 public FsRepository(string rootDirectory)
 {
     RootDirectory = rootDirectory;
     LuceneIndex   = new LuceneIndex(IndexDirectory.FullName);
     DynamicSearchResultTypeName = $"{nameof(Repositories)}.{GetType().Name}SearchResult";
 }