Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Lucene get all the index

I am working on a windows application using Lucene. I want to get all the indexed keywords and use them as a source for a auto-suggest on search field. How can I receive all the indexed keywords in Lucene? I am fairly new in C#. Code itself is appreciated. Thanks.

like image 803
user348348 Avatar asked May 23 '10 16:05

user348348


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is C language?

C is an imperative procedural language supporting structured programming, lexical variable scope, and recursion, with a static type system. It was designed to be compiled to provide low-level access to memory and language constructs that map efficiently to machine instructions, all with minimal runtime support.

Is C language easy?

Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.

What is C full form?

Full form of C is “COMPILE”. One thing which was missing in C language was further added to C++ that is 'the concept of CLASSES'.


1 Answers

Are you looking extract all terms from the index?

private void GetIndexTerms(string indexFolder)
{
    List<String> termlist = new ArrayList<String>();
    IndexReader reader = IndexReader.open(indexFolder);
    TermEnum terms = reader.terms();
    while (terms.next()) 
    {
      Term term = terms.term();
      String termText = term.text();
      int frequency = reader.docFreq(term);
      termlist.add(termText);
    }
    reader.close();
}
like image 126
Mikos Avatar answered Nov 15 '22 00:11

Mikos