I try to implement a search for a phrase by using a span query as I found at stackoverflow:
But I have to write it as a request for NEST in VB.NET:
Dim sSpanClauses As New List(Of ISpanQuery)
For Each w In word.Split(" ")
sSpanClauses.Add(New SpanMultiTermQuery() With {
.Match = New MatchQuery() With {
.Field = p.searchField,
.Query = w,
.Fuzziness = Fuzziness.EditDistance(p.fuzziness),
.PrefixLength = 1
}})
Next
Dim sPhrase As New BoolQuery() With {
.Should = New SpanNearQuery() With {
.Clauses = sSpanClauses,
.Slop = 2,
.InOrder = True
}
}
The problem is that SpanNearQuery.Clauses expect an Enumarable Of(ISpanQuery) but I have to use SpanMultiTermQuery to implement fuzziness. SpanMultiTermQuery can not be added to a List(of ISpanQuery).
Where is my fault?
Regards
Stefan