lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pamela Foxcroft" <pamelafoxcr...@gmail.com>
Subject How can I read Lucene catalogs created by the Java version of lucene?
Date Tue, 17 Jul 2007 17:36:11 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message