lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Aroush" <geo...@aroush.net>
Subject RE: how do I get the multisearcher to work.
Date Thu, 25 May 2006 01:51:07 GMT
Hi Eyal,

Are you sure replacing HashTable with HashSet will fix this problem?

Pam: Did you test this code with 1.4.3 if so, did you get the same error?

Thanks.

-- George Aroush

-----Original Message-----
From: Eyal Post [mailto:eyalpost@epocalipse.com] 
Sent: Wednesday, May 24, 2006 4:43 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: how do I get the multisearcher to work.

Yes, seems like what I reported for 1.9 RC1:
http://sourceforge.net/forum/message.php?msg_id=3549420
Is still hapenning in RC2. 

George, I sent you back then a hashSet implementation in c# to use instead
of HashTable (to make it compatible with the java version). This will make
the code cleaner and will solve these kind of problems (dulicate keys) for
good. 
Are you planning to use it?

Eyal

-----Original Message-----
From: Pamela Foxcroft [mailto:pamelafoxcroft@gmail.com]
Sent: Wednesday, May 24, 2006 19:16 PM
To: lucene-net-dev@incubator.apache.org
Subject: how do I get the multisearcher to work.

I keep on getting this message. We are using 1.9 RC2. Item has already been
added. Key in dictionary: 'text:horse' Key being added: 'text:horse'

Here is my code - this is based on the lucene in action book.


using System;
using System.Collections.Generic;
using System.Text;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Search;
using Lucene.Net.QueryParsers;
using Lucene.Net.Store;
using Lucene.Net.Index;
using Lucene.Net.Documents;

namespace MultiSearcher
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] animals ={
"aardvark","beaver","coati","dog","elephant","frog","gila
monster","horse","iguana",

"javelina","kangaroo","lemur","moose","nematode","orca","python","quokka","r
at","scorpian","trrantula",
                "uramstyx","vicuna","walrus","Xuphias","yak","zebra"};

            Analyzer analyzer = new WhitespaceAnalyzer();

            Directory aTOmDirectory = new RAMDirectory();
            Directory nTOzDirectory = new RAMDirectory();

            IndexWriter aToMWriter = new IndexWriter(aTOmDirectory,
analyzer, true);
            IndexWriter nToZWriter = new IndexWriter(nTOzDirectory,
analyzer, true);

            for (int i = 0; i < animals.Length; i++)
            {
                Document doc = new Document();
                String animal = animals[i];

                doc.Add(Field.Text("text",animal.ToString()));
            if (i<10)
            {
                aToMWriter.AddDocument(doc);
            }
            else
            {

                nToZWriter.AddDocument(doc);
            }

            }
            aToMWriter.Close();
            nToZWriter.Close();

            IndexSearcher[] searchers = new IndexSearcher[2];
            searchers[0] = new IndexSearcher(aTOmDirectory);
            searchers[1] = new IndexSearcher(nTOzDirectory);

            MultiSearcher searcher = new MultiSearcher(searchers);

            Query query = QueryParser.Parse("horse","text" , new
StandardAnalyzer());
           Console.WriteLine("Query: " + query.ToString());
            Hits hits = searcher.Search(query);  Console.Write("end");
        }
    }
}



thanks



Pam


Mime
View raw message