lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy" <digyd...@gmail.com>
Subject RE: How can I read Lucene catalogs created by the Java version of lucene?
Date Tue, 17 Jul 2007 18:39:01 GMT
Hi Pamela,

The error message you get is not clear. 

Is it possible that your index is corrupt? Because Index created with Java
Lucene is compatible with the Lucene.Net(except compressed fields and
NumberTools)

DIGY

-----Original Message-----
From: Pamela Foxcroft [mailto:pamelafoxcroft@gmail.com] 
Sent: Tuesday, July 17, 2007 8:36 PM
To: lucene-net-dev@incubator.apache.org
Subject: How can I read Lucene catalogs created by the Java version of
lucene?

I am using the 2.1 version.

I keep on getting the message \\ServerName\JavaLucene\_l1v.fnm'

and the Java index does not have any files with this name.

Here is my code.


using System;

using System.Collections.Generic;

using System.Text;

using Lucene.Net;

using Lucene.Net.Search;

using Lucene.Net.QueryParsers;

using Lucene.Net.Analysis;

using Lucene.Net.Documents;

using Lucene.Net.Index;

namespace Search

{

class Program

{

static void Main(string[] args)

{

string SearchPhrase ="lucene";

Searchable [] remoteSearch = new Searchable[1];

IndexSearcher remoteSearch1 = new IndexSearcher("//10.0.30.33//JavaLucene");

//IndexSearcher remoteSearch2 = new IndexSearcher("//10.0.30.33/index2");

remoteSearch[0] = remoteSearch1;

//remoteSearch[1] = remoteSearch1;



ParallelMultiSearcher msearch1 = new ParallelMultiSearcher(remoteSearch);

QueryParser qp = new QueryParser("Contents", new
Lucene.Net.Analysis.Standard.StandardAnalyzer());

Query query = qp.Parse(SearchPhrase);



QueryParser parser= new QueryParser("Contents", new WhitespaceAnalyzer());

Query q =parser.Parse(SearchPhrase);

SortField sort2 = new SortField("PostDate",SortField.STRING,true);

Sort sort = new Sort(sort2);

WhitespaceAnalyzer analyzer= new WhitespaceAnalyzer();

int postid;

string partitionid;

DateTime start = DateTime.Now;

Hits hits= msearch1.Search(q,sort);

TimeSpan duration = DateTime.Now.Subtract(start);

int total = hits.Length();

Document doc = new Document();

int PostID;

for (int a=0; a < total; a++)

{

doc=hits.Doc(a);

PostID = int.Parse(doc.Get("PostID").Trim());

Console.WriteLine(PostID);

}

Console.WriteLine(total);

}

}

}


Mime
View raw message