ravendb

Populate KendoUi Treeview with RavenDB documents

时间秒杀一切 提交于 2019-12-13 22:14:36
问题 I am using MVC4 and C#. I have a KendoUI Treeview and I'd like to populate it with data from RavenDB. In the demo they use this: public JsonResult Employees(int? id) { var dataContext = new NorthwindDataContext(); var employees = from e in dataContext.Employees where (id.HasValue ? e.ReportsTo == id : e.ReportsTo == null) select new { id = e.EmployeeID, Name = e.FirstName + " " + e.LastName, hasChildren = e.Employees.Any() }; return Json(employees, JsonRequestBehavior.AllowGet); } Notice the

Raven appears to generate incorrect Lucene query for DateTime

微笑、不失礼 提交于 2019-12-13 19:21:33
问题 I have some documents stored in Raven, which have a CreationDate property, of type "DateTimeOffset". I have been attempting to get these documents returned in a query from C#, and they are never returned if I use the CreationDate in the query criteria. After watching the Raven console, I saw the query being issued was: Query: (FeedOwner:25eb541c\-b04a\-4f08\-b468\-65714f259ac2) AND ( Creati onDate:[20120524120000000 TO NULL] AND CreationDate:{* TO 20120525120000000}) I ran this query directly

RavenDb - Recursive queries/indexes, for Hierarchical Document

一世执手 提交于 2019-12-13 13:15:13
问题 I know this might be a bit of a silly question, probably doing it wrong but I'll ask any way. Lets say I have a set of Hierarchical Documents. The only information they contain about their place in the hierarchy is their parent id. If its null we have reached the top. Getting parents and children are the easy part. What I want to do is query for all the descendants and ancestors. I think I have to parts to this question. 1) To get the ancestors to a document is their any way to make a

Unable to read View Bag value from controller to view

元气小坏坏 提交于 2019-12-13 07:23:45
问题 I have created a view bag in controller's post back event which stores the image path. Then,i used this view bag value in image src attribute.But image is not displayed. Model: public class FileManagement { public string FileName { get; set; } public string Path { get; set; } } Code for uploading image [HttpPost] public ActionResult UploadPic(FileManagement fmanage, HttpPostedFileBase file) { string email = User.Identity.Name; if (file != null && file.ContentLength > 0) { var FileName =

RavenDB: How do I find/use custom Analyzers when in Embedded/RunInMemory mode?

非 Y 不嫁゛ 提交于 2019-12-13 06:13:05
问题 I would like to make use of this Alphanumeric Analyzer in my RavenDB implementation. I have it working in my staging environment (actual RavenDB server installation), but I am having trouble when it comes to unit tests run in my development environment (VS2013). I have indexes I create during my unit tests, and their creation fails when RavenDB is unable to find the custom analyzer. I understand that for an installed RavenDB server, you drop the compiled DLL in \Analyzers\ and restart the

IRavenQueryable<T> Search can't find &-sign (or other special characters)

孤人 提交于 2019-12-13 04:47:46
问题 In our own RavenQueryableExtensions class we have the following method: public static IRavenQueryable<T> SearchMultiple<T>(this IRavenQueryable<T> self, Expression<Func<T, object>> fieldSelector, string queries, decimal boost = 1, SearchOptions options = SearchOptions.Or) { if (String.IsNullOrEmpty(queries)) throw new ArgumentNullException("queries"); // More than two spaces or tabs are replaced with a single space var newQueries = Regex.Replace(queries, @"\s{2,}", " "); // not important for

Filter RavenDB Search Results

自作多情 提交于 2019-12-13 02:55:23
问题 I have a query that returns valid search results using the IRavenQueryable.Search method. However, I want to further filter those results via a .Where method call such that the search results are then filtered to only include those that have the matching ProjectId. My object structure is a set of Project entities each containing a collection of Issue entities. My index creates a projection of Issue Search Results that looks like: {Id, Key, Summary, Description, ProjectId, ProjectKey, Query}

RavenDB LINQ Query no longer works with new stable build (#616)

我的梦境 提交于 2019-12-13 02:33:50
问题 I'm using RavenDBMembership Provider and after trying the latest RavenDB new stable build (#616) one LINQ query simply stopped working. This is the method: private MembershipUserCollection FindUsers( Func<User, bool> predicate, int pageIndex, int pageSize, out int totalRecords) { var membershipUsers = new MembershipUserCollection(); using (var session = DocumentStore.OpenSession()) { var q = from u in session.Query<User>() where u.ApplicationName == ApplicationName //ApplicationName="MyApp"

RavenDB Get By List of IDs?

旧巷老猫 提交于 2019-12-13 00:44:11
问题 In RavenDB I need to get the latest insert for a document based on it's ID and filter by IDs from a list ie: List<Entity> GetLastByIds(List<int> ids); The Entity is similar to: class Entity { int id; //Unique identifier for the category the price applies to. int Price; //Changes with time DateTime Timestamp; //DateTime.UtcNow } so if I insert the following: session.Store(new Entity{Id = 1, Price = 12.5}); session.Store(new Entity{Id = 1, Price = 7.2}); session.Store(new Entity{Id = 1, Price =

RavenDB indexing errors

微笑、不失礼 提交于 2019-12-12 19:19:16
问题 I'm just getting started with Raven and an index I've created keeps failing to index anything. I've found a lot of errors on the Raven server that look like this: { Index: "HomeBlurb/IncludeTotalCosts", Error: "Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)", Timestamp: "2012-01-14T15:40:40.8943226Z", Document: null } The index I've created looks like this: public class HomeBlurb_IncludeTotalCosts : AbstractIndexCreationTask