ravendb

RavenDB: How can I properly index a cartesian product in a map-reduce?

百般思念 提交于 2019-12-12 04:25:54
问题 This question is a spin-off of RavenDB: Why do I get null-values for fields in this multi-map/reduce index?, but I realized, the problem was another. Consider my extremely simplified domain, rewritten to a movie rental store scenario for abstraction: public class User { public string Id { get; set; } } public class Movie { public string Id { get; set; } } public class MovieRental { public string Id { get; set; } public string MovieId { get; set; } public string UserId { get; set; } } It's a

RavenDB: how to retrieve the top nodes in a nested collection?

邮差的信 提交于 2019-12-12 04:17:00
问题 I stored the objects of the following classes in a ravendb database: public class Continent { public string Name { get; set; } public List<Country> Countries{ get; set; } } public class Countries { public string Name { get; set; } public List<Province> Provinces{ get; set; } } public class Province { public string Name { get; set; } public List<Province> Cities { get; set; } } public class City { public string Name { get; set; } public string Address { get; set; } } How can I retrieve from

Serializing anonymous types with json.net seems broken

让人想犯罪 __ 提交于 2019-12-12 01:26:20
问题 Latest edits after realizing that the issue seems to be in RavenDb library instead of json.net library So far I have always used this piece of code to serialize anonymous types: using Raven.Imports.Newtonsoft.Json; var anon = new { errors = new string[] { "Login error" } }; var settings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }; var str = JsonConvert.SerializeObject(anon, Formatting.None, settings); It was with json.net embedded inside

Search each element in string array for multiple terms using RavenDB and lucene

对着背影说爱祢 提交于 2019-12-11 20:21:54
问题 I have (among others) the follwing objects in my RavenDB: Object1 : { "Texts" : [ "one two", "three four" ] } Object2 : { "Texts" : [ "one three", "two four" ] } I want to find all objects where a string in Texts contains both of the terms one and two . If I index the field from doc in docs.Objects select new { Texts } and analyze it using the StandardAnalyzer the following query will return both Object1 and Object2 when I only want Object1 : Texts:(one AND two) How can I solve this? 回答1: If

RavenDB: how to transform a query into a lucene query?

与世无争的帅哥 提交于 2019-12-11 19:06:27
问题 I have the following code: public class Continent { public string Name { get; set; } public List<Country> Countries{ get; set; } } public class Countries { public string Name { get; set; } public List<Province> Provinces{ get; set; } } public class Province { public string Name { get; set; } public List<Province> Cities { get; set; } } public class City { public string Name { get; set; } public string Address { get; set; } } I want to transform the following query into a lucene query(e.g.,

RavenDB- Building Session Factory, singleton DocumentStore

☆樱花仙子☆ 提交于 2019-12-11 16:47:42
问题 I'm a newbie to RavenDb. I've built the RavenDB session factory like the below code. The idea is very much driven from the way we build NHibernateSessionHelpers. I hope this should work really well in production. Are there any suggestions to improve this from people who are experts in RavenDB? public class MXRavenDbSessionHelper { //---All new lazy singleton that's thread safe.--- private static Lazy<IDocumentStore> _lazyDocStore = new Lazy<IDocumentStore>(() => InitializeSessionFactory());

Is Boosting whole documents supported in an AbstractMultiMapIndexCreationTask<T> that utilizes the Reduce feature?

家住魔仙堡 提交于 2019-12-11 15:24:22
问题 I'm trying to boost documents based on how recent they were posted as discussed in this answer. The following index definition works fine creating an index that is populated with Article and Recipe entities. public class TestIndex : AbstractMultiMapIndexCreationTask<Result> { public TestIndex() { AddMap<Article>(docs => from doc in docs where !doc.IsDeleted select new Result { Id = doc.Id, Title = doc.Title, DatePublished = doc.DatePublished }.Boost(doc.DatePublished.Ticks / 1000000f));

Search inside an attachment in RavenDB

主宰稳场 提交于 2019-12-11 14:11:16
问题 I started to learn about NoSQL, but I can not find a some good examples for RavenDB. Can anybody tell me how to add Word, PDF, Excel, ... binary document as an attachment in RavenDB and search the content of that document? Is there any example for that? Is that possible? How can I make an MVC application for that? 回答1: First, understand that when we talk about "document databases" in NoSQL, we aren't talking about Word, PDF, Excel documents. We are usually talking about a document in JSON

Lucene.Net range subquery not returning expected results (RavenDB related)

妖精的绣舞 提交于 2019-12-11 12:52:38
问题 I'm trying to write a lucene query to filter some data in RavenDB. Some of the documents in this specific collection are assigned a sequential number, and the valid ranges are not continuous (for example, one range can be from 100-200 and another from 1000 to 1400). I want to query RavenDB using Raven Studio (v2.5, the Silverlight client) to retrieve all documents that have values outside of these user-defined ranges. This is the overly simplified document structure: { ExternalId: something/1

RavenDB and MsSql inside same transaction scope results in WebException

落爺英雄遲暮 提交于 2019-12-11 11:28:07
问题 In response to another question on stackoverflow RavenDB does not play nicely with Transaction Scope i have created a test case where i isolate my transactions for storing and reading. In my test case i am making a call to a raven document store and a mssql database within the same transaction. But i get a Web Exception. Any ideas why or how to solve it. Below is my code private static string con = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TestDB;Data Source=.";