title: How to calculate avgLengthPath in BM25 implementation for Lucene ( JAVA )
body: <p>Can anybody please explain to me how to calculate 'avgLengthPath' variable in the <a href="http://nlp.uned.es/~jperezi/Lucene-BM25/" rel="nofollow" title="BM25">BM25</a> implementation for Lucene. What I understand is that I have to calculate it during the indexing. But still it was not clear how to do so. </p>
  
  <p>the example provided :</p>
  
  <pre><code>IndexSearcher searcher = new IndexSearcher("IndexPath");
  
  //Load average length
  BM25Parameters.load(avgLengthPath);
  BM25BooleanQuery query = new BM25BooleanQuery("This is my Query", 
      "Search-Field",
      new StandardAnalyzer());
  
  TopDocs top = searcher.search(query, null, 10);
  ScoreDoc[] docs = top.scoreDocs;
  
  //Print results
  for (int i = 0; i $&lt;$ top.scoreDocs.length; i++) {
        System.out.println(docs[i].doc + ":"+docs[i].score);
  }
  </code></pre>
  
  <p>suggest that there are a method or class to load average length from.</p>
  
  <p>Would appreciate any help...</p>
  
  <p>Thanks</p>