如何在powershell中使用Array.Find方法?
例如:
$a = 1,2,3,4,5
[Array]::Find($a, { args[0] -eq 3 })
Run Code Online (Sandbox Code Playgroud)
给
Cannot find an overload for "Find" and the argument count: "2".
At line:3 char:1
+ [Array]::Find($a, { $args[0] -eq 3 })
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
Run Code Online (Sandbox Code Playgroud)
数组类具有我期望的方法,如下所示:
PS> [Array] | Get-Member -Static
TypeName: System.Array
Name MemberType Definition
---- ---------- ----------
Find Method static T Find[T](T[] array, System.Predicate[T] match)
Run Code Online (Sandbox Code Playgroud)
数组是否应该转换为与T []类型相匹配的其他内容?我知道有其他方法可以实现查找功能,但我想知道为什么这不起作用.
当我希望精确匹配排名高于"部分"匹配时,应该使用哪些分析器进行索引和搜索?可能在Similarity课堂上设置自定义评分?
例如,当我的指标包括car parts,car,和car shop(索引与StandardAnalyzerLucene的3.5),用于查询"car"的结果:
(基本上按照添加顺序返回,因为它们都得到相同的分数).
我希望看到的是car排名第一,然后是其他结果(与哪个顺序无关,我认为分析仪可以影响它).