问题
I have collection of documents Message in RavenDB. Definition:
class Message
{
string Content;
Tag[] Tags;
}
class Tag
{
string Value;
}
And i have index:
from doc in docs.Messages
from docTagsItem in (IEnumerable<dynamic>)doc.Tags
select new { Content = doc.Content, TagsValue = docTagsItem.Value }
Here we have field with name TagsValue which isn't part of class Message, that's why i can't using
Session.Query<Message>(indexName).Where(m=>m.TagsValue==tagValue)
How should query this index from .NET by TagValue? Should i use Advanced.LuceneQuery?
回答1:
Because you use Linq you need to create a type with that property to query that, or you can use Lucene API.
Note that you don't actually need to make a query like that using a static index, you can do that using just dynamic indexes and pure linq.
来源:https://stackoverflow.com/questions/7411671/ravendb-query-index-with-custom-fields-names