Hi Kai

No, I have no problem returning hits.

When I do have problems like this, I usually find I have something
more to learn about Lucene indexing.  Try looking at the data and
query in Luke.  I usually find this is the best way to understand what
is going on.

Here is the link to Luke:
http://www.getopt.org/luke/

I hope you get it sorted.

Patrick

On 07/08/07, Kai Hu <[EMAIL PROTECTED]> wrote:
> By the way, Patrick,did you have a problem that IndexSearcher.search(Query 
> query) cann't get the all matched hits.it only return a part of matched hits.
> my test code is:
>         String key = "title:good";
>         Directory directory = FSDirectory.getDirectory("d:\\index\\");
>         IndexSearcher searcher = new IndexSearcher(directory);
>         QueryParser queryParser = new QueryParser("",analyzer);
>         Query query = queryParser.parse(key);
>         hits = searcher.search(query,sort);
> there are two documents indexed which "title" value is "good",but when I 
> searched by key"title:good",it returned only one documents.is it a bug?
>
> kai
>
> >Hi Kai
> >We keep a synchronized map of LuceneIndexAccessor instances, one instance per
> >The map is keyed on the directory path.  We then re-use
> >the accessor rather than creating a new one each time.
> >
> >Patrick
> On 06/08/07, Kai Hu <[EMAIL PROTECTED]> wrote:
> > Thanks , Patrick,
> >
> > It is useful. But I found a problem that I use
> >
> > "new LuceneIndexAccessor(accessProvider);" when a request comes in B/S,the 
> > LuceneIndexAccessor.getWriter() will lose its sense,it will new an 
> > IndexWriter.
> >
> > public IndexWriter getWriter() throws IOException {
> >
> >        IndexWriter result;
> >
> >        synchronized (this) {//here "synchronized" will lose its sense
> >
> >            checkClosed();
> >
> >            ...
> >
> >        if (cachedWriter != null) {
> >
> >               log.debug("returning cached writer");
> >
> >               result = cachedWriter;
> >
> >               writerUseCount++;
> >
> >            } else {
> >
> >               log.debug("opening new writer and caching it");
> >
> >               result = accessProvider.getWriter();// when new a 
> > LuceneIndexAccessor Object ,it will new an IndexWriter Object
> >
> >               cachedWriter = result;
> >
> >               writerUseCount = 1;
> >
> >            }
> >
> >     }
> >
> > }
> >
> > It will also throw a Exception "cann't obtain the Lock",should I use a 
> > single instance of LuceneIndexAccessor? Suppose I use a single instance of 
> > LuceneIndexAccessor,how to set a different Directory or Analyzer at one 
> > time.
> >
> >
> >
> > kai
> >
> >
> > ///////////////////////////////////////////////////////////
> >
> > ///////////////////////////////////////////////////////////
> >
> >
> >
> > >Hi Kai
> >
> > >
> >
> > >We use the Lucene Index Accessor contribution:
> >
> > >
> >
> > >http://www.nabble.com/Fwd%3A-Contribution%3A-LuceneIndexAccessor-t17416.html#a47049
> >
> > >
> >
> > >Patrick
> >
> >
> >
> > On 06/08/07, Kai Hu <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> >
> > >
> >
> > >          How do you solve the problems when add,update,delete documents
> >
> > > in muti-threads,use synchronized ?
> >
> > >
> >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> >
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to