lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Cortes <dcor...@fib.upc.edu>
Subject Multisearcher problem
Date Fri, 22 Jul 2005 13:39:14 GMT
Hi everyboy, the context of the problem
I have 6 index created by IndexWriter (1 index has something indexed, 
but the others are empty (only the segment file)).
I Use this to search in all index at same time
 
//This line I don't know what is her function, but I don't think that is 
the problem
private String[] fields= new String[] {"TITLE","CONTENTS","DESCRIPTION"};
private int[] required= 
{MultiFieldQueryParser.NORMAL_FIELD,MultiFieldQueryParser.NORMAL_FIELD,MultiFieldQueryParser.NORMAL_FIELD};
IndexSearcher[] searchers;

//I  initialize  searchers and do this;
            MultiSearcher searcher = new MultiSearcher(searchers);
            Query searcht = 
MultiFieldQueryParser.parse("something",fields,required,getTheInstanceOfMyAnalizer());
            Hits resul=searcher.search(searcht);


and the firsts search works, but after I have this:

java.io.IOException: Bad file descriptor
        at java.io.RandomAccessFile.seek(Native Method)
        at 
org.apache.lucene.store.FSInputStream.readInternal(FSDirectory.java:415)
        at 
org.apache.lucene.store.InputStream.readBytes(InputStream.java:61)
        at 
org.apache.lucene.index.CompoundFileReader$CSInputStream.readInternal(CompoundFileReader.java:220)
        at org.apache.lucene.store.InputStream.refill(InputStream.java:158)
        at org.apache.lucene.store.InputStream.readByte(InputStream.java:43)
        at org.apache.lucene.store.InputStream.readVInt(InputStream.java:83)
        at 
org.apache.lucene.index.SegmentTermEnum.readTerm(SegmentTermEnum.java:142)
        at 
org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:115)
        at 
org.apache.lucene.index.TermInfosReader.scanEnum(TermInfosReader.java:143)
        at 
org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:137)
        at 
org.apache.lucene.index.SegmentReader.docFreq(SegmentReader.java:253)
        at 
org.apache.lucene.search.IndexSearcher.docFreq(IndexSearcher.java:69)
        at org.apache.lucene.search.Similarity.idf(Similarity.java:255)
        at 
org.apache.lucene.search.TermQuery$TermWeight.sumOfSquaredWeights(TermQuery.java:47)
        at 
org.apache.lucene.search.BooleanQuery$BooleanWeight.sumOfSquaredWeights(BooleanQuery.java:110)
        at org.apache.lucene.search.Query.weight(Query.java:86)
        at 
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:85)
        at 
org.apache.lucene.search.MultiSearcher.search(MultiSearcher.java:116)
        at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:64)
        at org.apache.lucene.search.Hits.<init>(Hits.java:43)
        at org.apache.lucene.search.Searcher.search(Searcher.java:33)


some ideas please?
If I try to open my indexs with LUKE the index that has something, don't 
give me problems and I acan see their fields, but the other empties 
index (only a file called segments) ever reply my: Invalid path, or not 
a Lucene index.
Perhaps don't  I create well the indexs?

I do this for every File indexDir
            IndexWriter writer;
            File dir = new File();
             if (dir.isDirectory()) {
                writer = new IndexWriter(dir, myAnalyzer, false);
                writer.setUseCompoundFile(true);
             } else {
                dir.mkdirs();
                 writer = new IndexWriter(dir, myAnalyzer, true);
                writer.setUseCompoundFile(true);
             }
                writer.optimize();
                writer.close();

Is it correct?
I hope this lines with a solution for my problem can be used already for 
someone.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message