Assuming that you store the URLs untokenized you can use TermEnum like
below:

 

Lucene.Net.Index.IndexReader rdr = Lucene.Net.Index.IndexReader.Open(INDEX);

 

            string field = "URL";

            string prefix = "go";

 

            Lucene.Net.Index.TermEnum tEnum =  rdr.Terms( new
Lucene.Net.Index.Term(field,prefix) );

            while(tEnum.Next())

            {

                if(! tEnum.Term().Text().StartsWith(prefix) ) break;

                Console.WriteLine( tEnum.Term().Text() );

            }

 

 

DIGY

 

-----Original Message-----
From: Eric Svensson [mailto:[email protected]] 
Sent: Wednesday, July 29, 2009 3:16 PM
To: [email protected]
Subject: Search autocomplete/suggestion

 

I would like to implement automatic phrase suggestion as one type in the

searchfield. I have tried different Lucene.net quries without any luck.

The functionality I would like is simialr to the SQL Like % method.

 

For instance, if one types "g", "go", "goo", "goog"...  I would like "

google.com" in the search result, but I don't want "docs.google.com".

My main problem is that Lucene.net is searching by terms and I can't figure

out how to force it to exclude "docs.google.com" from the results.

Reply via email to