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 Re: another problem with Multisearcher
Date Fri, 29 Jul 2005 09:21:32 GMT
I reply myself, the problem was generated because I closed multisearcher 
when I finalize:

       SearchResults sr=null;
           Query buscar = 
MultiFieldQueryParser.parse(search_text,fields,required,analyzer);
           Hits encontrados=searcher.search(buscar);
           sr = new SearchResults(encontrados,userviewer,idPortal);
       searcher.close();  
<-------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
But when I have to close?

I have another question about mulisearcher,  how I have to use this     
                    MultiFieldQueryParser.NORMAL_FIELD

thks to all for yours replies
Daniel Cortes wrote:

> It's very strange because the first search works good , but next 
> search not works and give me the error message
>
> 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.refill(InputStream.java:158)
>        at 
> org.apache.lucene.store.InputStream.readByte(InputStream.java:43)
>        at 
> org.apache.lucene.store.InputStream.readBytes(InputStream.java:57)
>        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.TermInfosReader.terms(TermInfosReader.java:196)
>        at 
> org.apache.lucene.index.SegmentReader.terms(SegmentReader.java:230)
>        at 
> org.apache.lucene.search.PrefixQuery.rewrite(PrefixQuery.java:39)
>        at 
> org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:243)
>        at 
> org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:166)
>        at org.apache.lucene.search.Query.weight(Query.java:84)
>        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)
>        at org.apache.lucene.search.Searcher.search(Searcher.java:27)
>
> I've opened the index with Luke and the index are good.
>
> My code that use Multisearcher:
>
> this line I don't know what it do, but i think that is not the problem
> private int[] required= 
> {MultiFieldQueryParser.NORMAL_FIELD,MultiFieldQueryParser.NORMAL_FIELD,MultiFieldQueryParser.NORMAL_FIELD};

>
> private IndexSearcher[] searchers;
>       //indexs have the path of my indexs Lucene
>
>       for (int i = 0; i < indexs.length; i++) {
>            searchers[i] = new IndexSearcher(getPath(indexs[i]));
>       }
>        searcher = new MultiSearcher(searchers);
>        MultiSearcher searcher=iService.openMultiSearcher();
>        SearchResults sr=null;
>            Query buscar = 
> MultiFieldQueryParser.parse(search_text,fields,required,analyzer);
>            Hits encontrados=searcher.search(buscar);
>            sr = new SearchResults(encontrados,userviewer,idPortal);
>        searcher.close();
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
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