0
votes

I have and index created using solr DIH. I want to query that index data using the Lucene.net library.

the path of solr index is D:\Tests\solr\example\example-DIH\solr\db\data\index

the code I use to create lucene index directory object is as follows:

Analyzer anz = new StandardAnalyzer();
Directory dir = 
 FSDirectory.GetDirectory(@"D:\Tests\solr\example\example DIH\solr\db\data\index", false);
IndexSearcher isearcher = new IndexSearcher(dir);

while executing the last line of code I get the following exception:

Could not find file 'D:\Tests\solr\example\example-DIH\solr\db\data\index\segments'.

Given that the files within my solr index folder are

  • _0.fdt
  • _0.fdx
  • _0.fnm
  • _0.frq
  • _0.nrm
  • _0.prx
  • _0.tii
  • _0.tis
  • segments.gen
  • segments_2

So what is the problem??

1

1 Answers

0
votes

Lucene.NET is only up to Lucene version 2.9.2.2 or so while solr is running on Lucene 2.9.3. This means that Lucene.NET can't index a SOLR index so easily.

Now, what you can do is use something like SolrSharp to access Solr directly, sidestepping this version issue.