Re: Add unique id to a doc

2005-07-22 Thread Riccardo Daviddi
I 'll take a look at it, thx.

On 7/22/05, Peter Friend <[EMAIL PROTECTED]> wrote:
> 
> On Jul 21, 2005, at 8:53 AM, Riccardo Daviddi wrote:
> 
> > it's possible to set an unique id (as keyword field) to a doc by
> > looking in the index? I mean, it's possible to look in the index and
> > know what is the last id (which is a keyword field) and then decide
> > for the new id to associate to the new indexed doc?
> 
> I am planning on using a DCE UUID for the purpose of identifying
> documents in the index. It is well defined, and the id contains all
> sorts of information that could be useful.
> 
> Peter
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Riccardo Daviddi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Multisearcher problem

2005-07-22 Thread Daniel Cortes

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.(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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]