You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Tim Haughton <ti...@gmail.com> on 2008/10/13 17:22:34 UTC

Term Dictionary Items

I want to add auto complete to a search box in a document management
application. To do this, I'm going to need to get access to all terms stored
in the Term Dictionary. How would I go about this?  I've got the Manning
Lucene book but couldn't find anything in there, although feel free to point
me in the right direction if you know where help can be found.

Cheers,

Tim

Re: Term Dictionary Items

Posted by Tim Haughton <ti...@gmail.com>.
Those hit the spot. Thanks guys.

Tim

2008/10/13 Digy <di...@gmail.com>

> Maybe, that function can be useful
>
>          //returns the term-text which is equal or greater than "Text"
>          string GetClosestTerm(IndexReader reader,string Field,string Text)
>        {
>            TermEnum te = reader.Terms( new Term(Field, Text) );
>            if(te!=null && te.Term()!=null)
>                return te.Term().Text();
>
>            return "";
>        }
>
> DIGY
>
>
> -----Original Message-----
> From: Tim Haughton [mailto:timhaughton@gmail.com]
> Sent: Monday, October 13, 2008 6:23 PM
> To: lucene-net-user@incubator.apache.org
> Subject: Term Dictionary Items
>
> I want to add auto complete to a search box in a document management
> application. To do this, I'm going to need to get access to all terms
> stored
> in the Term Dictionary. How would I go about this?  I've got the Manning
> Lucene book but couldn't find anything in there, although feel free to
> point
> me in the right direction if you know where help can be found.
>
> Cheers,
>
> Tim
>
>

RE: Term Dictionary Items

Posted by Digy <di...@gmail.com>.
Maybe, that function can be useful

	  //returns the term-text which is equal or greater than "Text"
	  string GetClosestTerm(IndexReader reader,string Field,string Text)
        {
            TermEnum te = reader.Terms( new Term(Field, Text) );
            if(te!=null && te.Term()!=null) 
                return te.Term().Text();

            return "";
        }

DIGY


-----Original Message-----
From: Tim Haughton [mailto:timhaughton@gmail.com] 
Sent: Monday, October 13, 2008 6:23 PM
To: lucene-net-user@incubator.apache.org
Subject: Term Dictionary Items

I want to add auto complete to a search box in a document management
application. To do this, I'm going to need to get access to all terms stored
in the Term Dictionary. How would I go about this?  I've got the Manning
Lucene book but couldn't find anything in there, although feel free to point
me in the right direction if you know where help can be found.

Cheers,

Tim


RE: Term Dictionary Items

Posted by "Granroth, Neal V." <ne...@thermofisher.com>.
You can use a TermEnum enumerator, accessed through an instance of IndexReader, to walk through the list of terms.
There is an example of this on Page 198 in "Lucene in Action".

-- Neal

-----Original Message-----
From: Tim Haughton [mailto:timhaughton@gmail.com]
Sent: Monday, October 13, 2008 10:23 AM
To: lucene-net-user@incubator.apache.org
Subject: Term Dictionary Items

I want to add auto complete to a search box in a document management
application. To do this, I'm going to need to get access to all terms stored
in the Term Dictionary. How would I go about this?  I've got the Manning
Lucene book but couldn't find anything in there, although feel free to point
me in the right direction if you know where help can be found.

Cheers,

Tim