关于 LDAP 搜索查询
假设我要搜索 123
等号码,并且 LDAP 具有 123#
或 1-2-3
等条目。需要提供什么 LDAP 搜索过滤器?我尝试了 *123*
但在 1-2-3
情况下不起作用。
Let's suppose that I want to search a number say 123
and LDAP has entries like 123#
or 1-2-3
. What should be the LDAP Search filter which needs to be provided? I tried *123*
but it doesn't work in case of 1-2-3
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
LDAP 没有“像 123# 这样的条目”,它具有由包含属性的专有名称标识的条目。要搜索包含值的条目,必须向搜索请求提供以下参数:
如果相关属性名为
number 的语法为 Integer and如果匹配规则为 IntegerMatch,则过滤器
(number=123)
将查找名为number
且整数值为123
的属性。使用取决于属性类型定义中的语法和匹配规则,因为目录服务器执行将属性值与所提供的具有匹配规则的过滤器进行匹配的任务(顺便说一下,应用程序必须如此)。 “字符串”,相反,他们必须理解属性语法和匹配规则。有一个DirectoryString
语法(具有非常具体的定义,尽管出于许多目的,它可以被视为普通字符串),但并非所有属性都使用DirectoryString
语法定义。并非所有属性都使用相同的匹配规则和排序规则。另请参阅
LDAP does not have "entries like 123#", it has entries identified by distinguished names that contain attributes. To search for an an entry that contains a value, you must provide the following parameters to a search request:
If the attribute in question is named
number
and has a syntax of Integer and a matching rule of IntegerMatch, then the filter(number=123)
will find an attribute namednumber
with the integer value of123
. Which filter to use depends on the syntax and matching rule in the attribute type definition because the directory server performs the task of matching attribute values against provided filters with matching rules (as must applications, by the way). Programmers must not consider LDAP attribute values to be "strings", instead they must understand attribute syntaxes and matching rules. There is aDirectoryString
syntax (with a very specific definition, though for many purposes it can be considered a garden-variety string) but not all attributes are defined withDirectoryString
syntax. Nor do all attributes use the same matching rules and ordering rules.see also