在商业应用中,拥有数百个方面并不是一成不变的.当然,并非所有产品都带有所有产品.
但是在搜索时我需要添加一个facet querystring参数,列出我想要回来的所有方面.由于我不知道相关的列表,我必须在查询中传递所有这些.这不实用我们不仅仅是几个方面.
有没有办法解决这个问题,还是产品的限制?
Azure搜索文档:
https://msdn.microsoft.com/fr-fr/library/azure/dn798927.aspx
我正在使用新的(预览版)Azure 搜索 SDK(此处的信息)。我正在使用 oData 表达式语法来使用$filter参数构建我的搜索查询,并且我希望能够将一组 id 提供给端点。BrandId 字段位于我的 Azure 搜索索引中,它是可搜索、可过滤、可排序和可分面的。理想情况下,我希望能够按照以下方式做一些事情:
http://host/service/Products?brands=["1","2"]
Run Code Online (Sandbox Code Playgroud)
我不知道使用什么语法来在$filter查询中包含集合文字语法。所以我目前只是将逻辑ORs 的负载串连在一起以形成查询,而不是理想的:
var sp = new SearchParameters();
string filter = "$filter=";
if(brands.Length > 0)
{
int counter = 0;
foreach(string brand in brands)
{
if(counter == 0)
{
filter += "(brandId eq '" + brand + "'";
}
else if(counter == (brands.Count() - 1))
{
filter += " or brandId eq '" + brand + "')"; …Run Code Online (Sandbox Code Playgroud) 我正在使用 Azure 搜索并尝试对文档执行搜索:
好像这样做: /indexes/blah/docs?api-version=2015-02-28&search=abc\-1003
返回与此相同的结果: /indexes/blah/docs?api-version=2015-02-28&search=abc-1003
由于转义反斜杠,第一个不应该返回与第二个不同的结果吗?据我了解,反斜杠应该允许对“abc-1003”的整个字符串进行精确搜索,而不是使用“not”运算符。
(更多信息在这里:https : //msdn.microsoft.com/en-us/library/azure/dn798920.aspx)
我可以让它工作的唯一方法是这样做(注意双引号): /indexes/blah/docs?api-version=2015-02-28&search="abc-1003"
我宁愿不这样做,因为这意味着让用户输入引号,而他们不知道该怎么做。
我是否在期待一些我不应该做的事情,或者它可能是 Azure 搜索的一个错误?
我正在使用Azure Search .Net SDK.
我正在调用这样的同步(NOT ASYNC)函数:
var searchResults = searchIndexClient.Documents.Search<T>(searchText, searchParameters);
Run Code Online (Sandbox Code Playgroud)
它通常有效.我没有使用任何异步函数,但不知何故我刚刚得到的错误看起来像一个异步错误:
System.Threading.Tasks.TaskCanceledException: A task was canceled.
CancellationToken: IsCanceleationRequested=false
Task: Id = 556, Status = Canceled, Method = "{null}", Result = "{Not yet computed}"
StackTrace:
Run Code Online (Sandbox Code Playgroud)
在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)System.Runtime.CompilerServices.ConfiguredTaskAwaitable的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Search.DocumentsOperations.<DoContinueSearchWithHttpMessagesAsync>d__153.MoveNext()---来自之前的堆栈跟踪结束抛出异常的位置---在系统的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)的System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()处系统的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) .Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.Search.DocumentsOperationsExtensions.<SearchAsync>d__151.MoveNext()---抛出异常的前一个位置的堆栈跟踪结束---在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess上的System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()处System.Runtime.CompilerServices.TaskAwaite上System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)的(任务任务)r1.GetResult() at Microsoft.Azure.Search.DocumentsOperationsExtensions.Search[T](IDocumentsOperations operations, String searchText, SearchParameters searchParameters, SearchRequestOptions searchRequestOptions) at MyApp.AzureSearch.AzureSearchService.PerformSearch[T](String searchText, SearchParameters searchParameters) in c:\Projects\MyAppServer\src\MyApp.AzureSearch\AzureSearchService.cs:line 359 at MyApp.AzureSearch.AzureSearchService.Search[T](String searchText, List1 searchFields,SearchMode searchMode,List1 select, Nullable1 skip,Nullable1 top, String filter, Boolean …
我有一个 Azure 搜索服务,用于根据 BLOB 元数据搜索 BLOBS(即图像)。
搜索所基于的索引设置为每小时刷新一次。
但是,我仍然得到搜索结果中不再存在的 BLOB 的结果。
使用获取索引器状态 API(下面的输出)显示在删除 BLOBS 后索引已成功刷新。
"status": "running",
"lastResult": {
"status": "success",
"errorMessage": null,
"startTime": "2018-02-05T16:00:03.29Z",
"endTime": "2018-02-05T16:00:03.416Z",
"errors": [],
"warnings": [],
"itemsProcessed": 0,
"itemsFailed": 0,
"initialTrackingState": "{\r\n \"lastFullEnumerationStartTime\": \"2018-02-05T14:59:31.966Z\",\r\n \"lastAttemptedEnumerationStartTime\": \"2018-02-05T14:59:31.966Z\",\r\n \"nameHighWaterMark\": null\r\n}",
"finalTrackingState": "{\"LastFullEnumerationStartTime\":\"2018-02-05T15:59:33.2900956+00:00\",\"LastAttemptedEnumerationStartTime\":\"2018-02-05T15:59:33.2900956+00:00\",\"NameHighWaterMark\":null}"
},
"
Run Code Online (Sandbox Code Playgroud)
如果相关,则使用Azure 存储资源管理器删除了 BLOB
这导致的问题是这些图像被输出到网页并且当前显示为丢失的图像以及使索引大于它需要的大小。
azure azure-storage-blobs azure-cognitive-search azure-blob-storage
我使用 Azure 搜索索引器对 MongoDB CosmosDB 中的文档进行索引,该数据库包含带有名为 的字段的对象_id。由于 Azure 搜索不允许在索引中的字段名称开头使用下划线,因此我想创建字段映射。
Cosmos 中的 JSON 结构 --> 索引中的结构
{
"id": "test"
"name": "test",
"productLine": {
"_id": "123", --> "id": "123"
"name": "test"
}
}
Run Code Online (Sandbox Code Playgroud)
该文档正是以这种情况作为示例,但仅适用于顶级字段。
"fieldMappings" : [ { "sourceFieldName" : "_id", "targetFieldName" : "id" } ]}
我尝试了以下方法:
"fieldMappings" : [ { "sourceFieldName" : "productLine/_id", "targetFieldName" : "productLine/id" } ] }
这会导致错误:
Value is not accepted. Valid values: "doc_id", "name", "productName".
为作为子字段的目标字段创建映射的正确方法是什么?
昨天我们非常兴奋。我们的两个使用 AzureSearch 的 SDK 的 Web 应用程序(已部署和至少 3 个月未受影响)在不同时间(一个清晨;另一个在晚上)停止工作。indexClient.Documents.Search 方法开始失败并出现以下错误:
与 XXXXsearch.search.windows.net(#435)的 HTTPS 握手失败。System.IO.IOException 无法从传输连接读取数据:远程主机强制关闭现有连接。< 现有连接被远程主机强行关闭
在疯狂的谷歌争夺之后,我们在修复它的搜索之前添加了这 3 行。
const SslProtocols _Tls12 = (SslProtocols)0x00000C00;
const SecurityProtocolType Tls12 = (SecurityProtocolType)_Tls12;
ServicePointManager.SecurityProtocol = Tls12;
Run Code Online (Sandbox Code Playgroud)
我所能想象的只是我们错过了某种“AzureSDK 正在改变”电子邮件?这非常糟糕,我们很幸运能够快速解决问题,否则它可能是一场灾难。有谁知道为什么会发生这种情况?
您好,我有一个字符串字段,对于某些文档可以为空\null。我想知道如何搜索这些文档。
我想通过 searchquery 而不是 ODatFilter 了解,因为我可能想解决以下情况:
因此,ODataFilter 建议无助于实现 #2,因此 #1 应该使用 searchQuery。
任何帮助表示赞赏。
因此,我尝试使用 Azure 搜索对我的表存储进行查询,该表已编入索引。在此处查看表的实体
[SerializePropertyNamesAsCamelCase]
public class Asset : TableEntity
{
public Asset(){ }
public Asset(string name, DateTimeOffset toBePublished)
{
Name = name;
ToBePublishedDate = toBePublished.ToString();
}
[System.ComponentModel.DataAnnotations.Key]
public string Id{ get; set; } = DateTimeOffset.UtcNow.ToString();
[IsFilterable, IsSortable, IsSearchable]
public string Name { get; set; }
[IsFilterable, IsSortable, IsSearchable]
public string Version { get; set; }
[IsFilterable, IsSortable, IsSearchable]
public string ToBePublishedDate { get; set; }
[IsFilterable, IsSortable, IsSearchable]
public string ToBeRetiredDate { get; set; }
[IsFilterable, IsSortable]
public bool IsApproved …Run Code Online (Sandbox Code Playgroud) 我想搜索名称为“14009-00080300”的字段,并且我想在仅搜索其中的一部分时获得命中,例如“14009-000803”。
使用此代码我没有得到任何点击:
{
"search": "\"14009-000803\"*",
"count":true,
"top":10
}
Run Code Online (Sandbox Code Playgroud)
有没有办法像 SQL 使用通配符搜索一样使用 azure 搜索?(select * from table where col like '%abc%' ?