首页 \ 问答 \ 匹配弹性搜索中的精确短语(Matching exact phrase in elastic search)

匹配弹性搜索中的精确短语(Matching exact phrase in elastic search)

所以我有这样的查询:

{  
   "from":0,
   "size":20,
   "sort":{  
      "prices_count":"desc"
   },
   "query":{  
      "bool":{  
         "must":[  
            {  
               "terms":{  
                  "category_ids":[  
                     "3"
                  ]
               }
            },     
            {  
               "nested":{  
                  "path":"specs",
                  "query":{  
                     "bool":{  
                        "must":[  
                           {  
                              "match_phrase":{  
                                 "specs.model":"iphone-6s"
                              }
                           }
                        ]
                     }
                  }
               }
            }
         ]
      }
   }
}

我的问题在于嵌套查询部分。 specs.model查询不仅匹配模型iphone-6s文档,而且匹配iphone-6s-plus文档,我也尝试使用term匹配,但是后来我没有得到任何结果。 有任何想法吗?


So i have a query like this:

{  
   "from":0,
   "size":20,
   "sort":{  
      "prices_count":"desc"
   },
   "query":{  
      "bool":{  
         "must":[  
            {  
               "terms":{  
                  "category_ids":[  
                     "3"
                  ]
               }
            },     
            {  
               "nested":{  
                  "path":"specs",
                  "query":{  
                     "bool":{  
                        "must":[  
                           {  
                              "match_phrase":{  
                                 "specs.model":"iphone-6s"
                              }
                           }
                        ]
                     }
                  }
               }
            }
         ]
      }
   }
}

My problem lies in the nested query part. the specs.model query matches not just documents with model iphone-6s, but the ones with iphone-6s-plus, I tried with term matching too, but then I get no results what so ever. Any ideas?


原文:https://stackoverflow.com/questions/40969148
更新时间:2022-02-15 09:02

最满意答案

我不知道C所以我无法对你的代码发表评论,但是:

  1. 根据定义,gabor滤波器应该具有实部和虚部 - 即复数值。
  2. 你的内核看起来不像gabor内核。 它应该看起来像一个正弦曲线乘以高斯 - 你的看起来像一个高斯中心在左上角。 无需规范化。

我也会调整你的参数,使它们不是单一的。 绘制您的过滤器,看看它是否与您在Google上搜索“Gabor wavelet”时的效果相符。


I don't know C so I'm not able to comment on your code, but:

  1. By definition, a gabor filter should have a real part and an imaginary part - i.e. complex valued.
  2. Your kernel doesn't look anything like a gabor kernel. It should look like a sinusoid multiplied by a gaussian - yours looks like a gaussian centred in the top left corner. No need to normalise it.

I would also tweak your parameters so they aren't unitary. Plot your filter and see if it looks like what you get when you search for 'Gabor wavelet' on Google.

相关问答

更多
  • 我提供的链接将清除将清除您关于GABOR FILTER的基础知识,并让您开始模式识别 gabor过滤器的基础知识 GABOR过滤器的可视化 检查这些模式识别 The links i am providing will clear will clear your basics about GABOR FILTER as well as get you started on PATTERN RECOGNITION Basics of gabor filter Visualization of GABOR Fil ...
  • 卷积是关联的,这意味着(f*g)*h = f*(g*h) 。 而不是 r = conv(conv(x, [1,1,1]), [1,1,1]) 你可以使用更高效的(因为你只在图像上卷积一次) asd = conv([1,1,1], [1,1,1]); r = conv(x, asd) 其中新功能为[1 2 3 2 1] ,但其大小与原始过滤器的大小不同。 convolution is associative, which means (f*g)*h = f*(g*h). So instead of r = ...
  • 通过错误消息: ValueError:检查TARGET时出错:期望leaky_re_lu_6具有4个维度,但获得具有形状的数组(5,112,112) 我们可以看到问题在于y_train (您的训练输出数据)与模型的输出形状不兼容。 看来y_train应该有一个额外的维度或者模型的输出( leaky_re_lu_6 )应该用来匹配你当前的y_train 。 详细信息只有在我们更好地了解您的数据时才有可能:) By the error message: ValueError: Error when checki ...
  • 我不知道C所以我无法对你的代码发表评论,但是: 根据定义,gabor滤波器应该具有实部和虚部 - 即复数值。 你的内核看起来不像gabor内核。 它应该看起来像一个正弦曲线乘以高斯 - 你的看起来像一个高斯中心在左上角。 无需规范化。 我也会调整你的参数,使它们不是单一的。 绘制您的过滤器,看看它是否与您在Google上搜索“Gabor wavelet”时的效果相符。 I don't know C so I'm not able to comment on your code, but: By defini ...
  • 你看到的问题是因为TF没有真正计算卷积。 如果您将看看卷积实际做了什么的解释(检查卷积的Visual解释 ),您将看到第二个函数被翻转: 根据虚拟变量表示每个函数 反映其中一个功能(这是翻转) .....其他一些我不会在这里复制的东西。 除了翻转之外,TF会做所有事情。 所以你只需要在TF或numpy中翻转内核。 翻转1d的情况正好相反,为2d你需要翻转两个轴(旋转内核2次)。 import tensorflow as tf import numpy as np I = [1, 0, 2, 3, 0, 1 ...
  • 我将首先使用维基百科中的以下图像对卷积进行非常简短的讨论: 如图所示,卷积两个1-D函数涉及反映其中一个(即卷积内核),将两个函数相互滑动,并计算其乘积的积分。 当卷积二维矩阵时,卷积核心反映在两个维度中 ,然后计算每个与另一个矩阵的唯一重叠组合的乘积之和。 内核尺寸的这种反映是卷积的固有步骤。 然而,当执行滤波时,我们喜欢将滤波矩阵看作是一个“模板”,它直接在待滤波的矩阵上铺设(即没有反射)。 换句话说,我们希望执行与卷积相同的操作,但不反映滤波矩阵的维数。 为了消除在卷积期间执行的反射,我们因此可以在执 ...
  • 在代码中替换下面的行: gb= exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi); 我在上面的matlab代码中用sin替换了cos。 Replace below line in your code: gb= exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi); I repla ...
  • 好像你正在使用scipy的'ndimage.convolve'函数。 请记住,ndimage提供“N”维度卷积。 因此,如果您希望卷积起作用,则图像和内核必须具有相同数量的维度。 其中任何一个尺寸不正确都会导致您说出错误。 从上面的评论中,内核(4,4,7)无法与图像进行卷积(130,130)。 尝试在卷积之前添加单个维度,然后再将其删除。 img = np.zeros(shape=(130,130),dtype=np.float32) img = img[:,:,None] # Add singleton ...
  • 快速浏览后: 你是否意识到(int)r会使r值平坦化,而不是平常舍入? 在c代码中,你似乎使用(int)(r + 0.5) After a quick look: do you realize that (int)r will floor the r value instead of rounding it normally? in the c code, you seem to use (int)(r + 0.5)
  • 你问题中的rhs方程是卷积的无穷小描述 - 你有卷积运算符“*” ,它应用于图像的2D子范围 - 2d子范围表示为2D积分。 离散描述是类似的,但2D子范围用求和算子用西格玛符号“Σ”表示。 而不是2D积分,它被应用为“ΣΣ”(我不知道如何在这里输入数学符号)。 天真卷积的实现是使用2个循环 - 在图像的每个点中,您将核心值与该点和相邻点相乘 - P(x + c / 2)= P(x)* C(1)+ P(x + 1)* C(2)... + P(x + c)* C(c)(c是大小的内核) 。 该过程类似于具有多 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。