我正在使用MongoDB创建我的第一个应用程序.为字段创建索引,并尝试使用$ regex param在shell中启动查找查询
> db.foo.find({A:{$regex:'BLABLA!25500[0-9]'}}).explain()
{
"cursor" : "BtreeCursor A_1 multi",
"nscanned" : 500001,
"nscannedObjects" : 10,
"n" : 10,
"millis" : 956,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
"A" : [
[
"",
{
}
],
[
/BLABLA!25500[0-9]/,
/BLABLA!25500[0-9]/
]
]
}
}
Run Code Online (Sandbox Code Playgroud)
这很奇怪,因为当我启动相同的查询,但收集中没有索引时,性能要好得多.
> db.foo.find({A:{$regex:'BLABLA!25500[0-9]'}}).explain()
{
"cursor" : "BasicCursor",
"nscanned" : 500002,
"nscannedObjects" : 500002,
"n" : 10,
"millis" : 531,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : …Run Code Online (Sandbox Code Playgroud) 我有一个Activity,需要在其中显示Dialog.这里一切都很好.我在Activity中覆盖了onCreateDialog方法,这里是代码:
@Override
protected Dialog onCreateDialog(int dialog)
{
if(dialog == 10)
{
if(waitDialog != null)
waitDialog.dismiss();
dialogCreated = true;
waitDialog = CreateWaitDialog(this);
return waitDialog;
}
else
return new Dialog(this);
}
Run Code Online (Sandbox Code Playgroud)
其中CreateWaitDialog是创建对话框的自定义方法,而waitDialog是静态变量.
我通过调用showDialog(10)来显示对话框
所有代码都正常运行.
显示对话框后,我正在通过调用关闭它.
if(waitDialog != null)
waitDialog.hide();
Run Code Online (Sandbox Code Playgroud)
当Activity被销毁时我就会解雇它.
if(dialogCreated)
dismissDialog(10);
super.onDestroy();
Run Code Online (Sandbox Code Playgroud)
它正在关闭,一切都很棒.但是,当我更改设备的方向并重新创建活动时,它会自动弹出!我没有打电话给任何showDialog或类似的东西它只是弹出!
这是 Azure 认知搜索团队的问题。
面临高级搜索功能的严重问题,例如“模糊搜索”和“通配符搜索”。目前在我的索引字段上使用标准 Lucene 分析器。
系统返回搜索查询'终止'的结果,结果包含:终止、终止、终止等。所以结果看起来不错。但是当我尝试搜索 ' *terminat****' (当然使用 queryType=full 参数)时,搜索没有返回任何结果。根据文档,通配符搜索应该返回 * 'terminate'、'termination'、'terminates'*** 和其他以 'terminat*' 开头的术语。
模糊搜索也有同样的问题。如果我搜索“终止〜”,我根本没有得到任何结果。
如果我使用“ Microsoft Analyzer ”,情况似乎会更好。至少模糊搜索和通配符至少返回一些东西......
这是一个错误吗?或者这是预期的行为?可能我误解了文档?