Hi all, I am using Lucene.net V2.9 to create some concept clusters i.e. list of concepts and for each of those concepts associated concepts. But I am getting this exception in the MoreLikeThis.cs class:
AddTermFrequencies(new System.IO.StreamReader(text[j]), termFreqMap, fieldName);
Could not find file 'C:\DEV.....\Debug\signing technology'.
This exception is thrown in: private PriorityQueue RetrieveTerms(int docNum) method
I assume this is because the MLT class is looking for the file to load the text from. But it seems to take an argument of doc_id integer, which I am passing in properly. What am I doing wrong?
Lucene.Net.Store.Directory dir = Lucene.Net.Store.FSDirectory.GetDirectory("ConceptsIndex", false);
IndexSearcher obj = new IndexSearcher(dir, true);
QueryParser qp = new QueryParser(Lucene.Net.Util.Version.LUCENE_29,"Descriptors", new StandardAnalyzer());
Query q = qp.Parse(solrQuery);
TopDocs hits = obj.Search(q,null,10);
List<ConceptCluster> list = new List<ConceptCluster>();
for (int n = 0; n < hits.scoreDocs.GetLength(0); n++)
{
Document doc = obj.Doc(hits.scoreDocs[n].doc);
string concept = doc.Get("ConceptID");
MoreLikeThis mlt = new MoreLikeThis(obj.GetIndexReader());
mlt.SetFieldNames(new string[] { "Descriptors","Concept" });
mlt.SetMinDocFreq(5);
mlt.SetMinWordLen(3);
int like = hits.scoreDocs[n].doc;
Query mltQuery = mlt.Like(like);
TopDocs mltHits = obj.Search(mltQuery, null, 10);
ConceptCluster cc = new ConceptCluster();
cc.Concept = concept;
for (int m = 0; m < mltHits.scoreDocs.GetLength(0); m++)
{
cc.RelatedConcepts.Add(obj.Doc(mltHits.scoreDocs[m].doc).Get("ConceptID"));
}
list.Add(cc);
}