title: How to get the unique results from Lucene index?
body: <p>I am trying to search from lucene index . I want to get the unique results but its returning the duplicate results also. I searched on google and found it can be done with the help of a collector. How can I achieve this? </p>
  
  <p>I am using the following code:</p>
  
  <pre><code>File outputdir= new File("path upto lucene directory");
  Directory directory = FSDirectory.open(outputdir);
  IndexSearcher= new IndexSearcher(directory,true);
  
  QueryParser queryparser = new QueryParser(Version.LUCENE_36, "keyword", new StandardAnalyzer(Version.LUCENE_36));
  
  Query query = queryparser.parse("central");
  
  topdocs = indexSearcher.search(query, maxhits);
  ScoreDoc[] score = topdocs.scoreDocs;
  int length = score.length;
  </code></pre>