lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <>
Subject Re: Lucene.NET Integration
Date Tue, 26 May 2009 23:25:58 GMT
I don't think so.

First, fuzzy queries don't work that way.  The normal query parser will
accept ~ as a suffix operator to indicate that a term is fuzzy.

Secondly, you *really* should be using the same analyzer for your query
parsing as for your indexing.

Thirdly, I don't have a clue what you are doing with the fuzzy query.  Part
of that is just the visual basic syntax, but part of it is the code itself.
You should instantiate a query parser and then use it to parse your query.
You should not have to instantiate the Fuzzy query directly.  Also, it seems
that you have declared your query as a query, but then you are not
instantiating a query parser.  Generally, you need the parser to form the

It is not unusual for this to require some fancy footwork since few real
applications exactly match what the query parser does.  The footwork often
consists of rewriting the query as parsed into something different.  For
instance, you might change default field terms into references to both title
and to body text or you might have versions of the body text that are both
stemmed and not stemmed and want to query both.  Another area where
fanciness can be required is for cases where you have different analyzers
for different fields.

On Tue, May 26, 2009 at 3:05 PM, KingKory <> wrote:

> If I used something like this to instantiate my parser:
> Dim searcher As New Lucene.Net.Search.IndexSearcher("C:\SearchIndex")
> 'Dim query As Lucene.Net.Search.Query
> 'query = Lucene.Net.QueryParsers.QueryParser.Parse(mySearchQuery,
> "content",
> New Lucene.Net.Analysis.Standard.StandardAnalyzer)
> Dim query As New Lucene.Net.Search.FuzzyQuery(New
> Lucene.Net.Index.Term("content", "~" & mySearchQuery & "~"), 0.35, 0)
> Dim hits As Lucene.Net.Search.Hits
> hits = searcher.Search(query)
> 'Loop through hits, and display as web page.
> Would it be more successful?

Ted Dunning, CTO

111 West Evelyn Ave. Ste. 202
Sunnyvale, CA 94086
858-414-0013 (m)
408-773-0220 (fax)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message