RavenDB高级Lucene查询

时间:2011-08-10 10:31:55

标签: ravendb

我正在学习lucene和ravendb的绳索 - 我在Raven中有以下文件 -

{
  "InternalEvent": {
    "Desec": "MachineInfo: 1F8BFBFF000106A5_2103933941_00155D365607_WIN-UWJJ7OPR9TM_1, UserInfo: NT AUTHORITY\\LOCAL SERVICE_3, ProcessInfo: \\Device\\HarddiskVolume1\\Windows\\System32\\taskeng.exe, Pid: 5772, ObjInfo: , EventId: New Process Stopped",
    "MachineInfo": "1F8BFBFF000106A5_2103933941_00155D365607_WIN-UWJJ7OPR9TM_1",
    "UserInfo": "NT AUTHORITY\\LOCAL SERVICE_3",
    "ProcessInfo": "\\Device\\HarddiskVolume1\\Windows\\System32\\taskeng.exe",
    "Pid": 5772,
    "ObjInfo": "",
    "EventId": "New Process Stopped",
    "Occured": "2011-08-08T23:25:31.8220000+01:00"
  },
  "Key": "6c4abf6a-156e-4224-8eac-72cde756b3c6"
}

我用 -

查询数据库
var searchValue = "InternalEvent:Desec:(" + String.Join(" AND ", searchTerms) + ")";
var eventEntities = session.Advanced.LuceneQuery<EventCacheEntity>()
                                  .WaitForNonStaleResultsAsOfLastWrite()
                                  .Skip(0)
                                  .Take(_pageLimit)
                                  .Where(searchValue);

搜索任何类似的东西,例如searchTerms只有一个术语,如机器,它肯定在字段desec中。我做错了什么?

我对lucene查询语法中的嵌套字段不太确定 - 即Internalevent:Desec ??

1 个答案:

答案 0 :(得分:4)

嵌套字段的语法是InternalEvent.Desec,但我不确定您要对搜索字词做什么