
ted.dunning at gmail
May 26, 2009, 5:04 PM
Post #8 of 11
(675 views)
Permalink
|
http://lucene.apache.org/java/2_3_2/queryparsersyntax.html You may be able to succeed by escaping the space with a backslash. On Tue, May 26, 2009 at 4:45 PM, KingKory <cbkprice[at]gmail.com> wrote: > > > > Ted Dunning wrote: > > > > 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 > > query. > > > > 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 <cbkprice[at]gmail.com> 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 > > DeepDyve > > > > 111 West Evelyn Ave. Ste. 202 > > Sunnyvale, CA 94086 > > http://www.deepdyve.com > > 858-414-0013 (m) > > 408-773-0220 (fax) > > > > > Thanks Ted. > > I guess the question becomes: Is there any resource out there that > describes > the syntax used for the the Lucene StandardAnalyzer? > > I have no problem footworkin' these search terms into whatever form > necessary. > > Thanks for your help. > -- > View this message in context: > http://www.nabble.com/Lucene.NET-Integration-tp23731090p23733463.html > Sent from the Lucene - General mailing list archive at Nabble.com. > > -- Ted Dunning, CTO DeepDyve 111 West Evelyn Ave. Ste. 202 Sunnyvale, CA 94086 http://www.deepdyve.com 858-414-0013 (m) 408-773-0220 (fax)
|