views:

772

answers:

2

If the search query contains a leading wildcard character (* or ?), the QueryParser's Parse function throws an error.

Dim q As String = "*abc"
Dim qp As New QueryParser("text", New StandardAnalyzer())
Dim query As Query = qp.Parse(q)

Is there any way to solve this problem in Lucene.NET v2.0.0.4?

+1  A: 

Maybe you have to use a WildcardQuery, but

...In order to prevent extremely slow WildcardQueries, a Wildcard term should not start with one of the wildcards...

Peter
+2  A: 

Set QueryParser.SetAllowLeadingWildcard Method to true. The API page states that "this can produce very slow queries on big indexes" though.

Kai Chan