title: Multiple word Autosuggest using Lucene.Net
body: <p>I am currently working on an search application which uses Lucene.Net to index the data from the database to Index file. I have a product catalog which has Name, short and long description, sku and other fields. The data is stored in Index using StandardAnalyzer. I am  trying to add auto suggestion for a text field and using TermEnum to get all the keyword terms and its score from the Index. But the terms returned are of single term. For example, if I type for co, the suggestion returned are costume, count, collection, cowboy, combination etc. But I want the suggestion to return phrases. For exmaple, if I search for co, the suggestions should be cowboy costume, costume for adults, combination locks etc.</p>
  
  <p>The following is the code used to get the suggestions:</p>
  
  <pre><code>public string[] GetKeywords(string strSearchExp)
  {
  
  IndexReader rd = IndexReader.Open(mIndexLoc);
  TermEnum tenum = rd.Terms(new Term("Name", strSearchExp));
  string[] strResult = new string[10];
  int i = 0;
  Dictionary&lt;string, double&gt; KeywordList = new Dictionary&lt;string, double&gt;();
  do
  {
      //terms = tenum.Term();
      if (tenum.Term() != null)
      {
          //strResult[i] = terms.text.ToString();
          KeywordList.Add(tenum.Term().text.ToString(), tenum.DocFreq());
      }
  } while (tenum.Next() &amp;&amp; tenum.Term().text.StartsWith(strSearchExp) &amp;&amp; tenum.Term().text.Length &gt; 1);
  
  var sortedDict = (from entry in KeywordList orderby entry.Value descending select entry);
  
  foreach (KeyValuePair&lt;string, double&gt; data in sortedDict)
  {
      if (data.Key.Length &gt; 1)
      {
          strResult[i] = data.Key;
          i++;
      }
      if (i &gt;= 10)    //Exit the for Loop if the count exceeds 10
          break;
  }
  tenum.Close();
  rd.Close();
  return strResult;
  </code></pre>
  
  <p>}</p>
  
  <p>Can anyone please give me directions to achive this? Thanks for looking into this.</p>