You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Dan Adams <da...@ifactory.com> on 2005/10/24 16:07:21 UTC

indexwriter and index searcher

If I have a directory open and I open an index writer and add a document
do I have to close the directory and re-open it before I can open a
searcher and have the new document be included in the search?

In general, is it good to keep the directory open or is it better to
open the document each time you need a searcher or writer or something.

-- 
Dan Adams
Software Engineer
Interactive Factory


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


Re: indexwriter and index searcher

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On 24 Oct 2005, at 10:07, Dan Adams wrote:
> If I have a directory open and I open an index writer and add a  
> document
> do I have to close the directory and re-open it before I can open a
> searcher and have the new document be included in the search?

Yes.

> In general, is it good to keep the directory open or is it better to
> open the document each time you need a searcher or writer or  
> something.

In general it all depends :)

But, it is best to keep IndexSearcher cached over multiple searches  
and only recreate it when the index changes and you need to reflect  
those changes with future searches.

     Erik


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


Re: indexwriter and index searcher

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
I think you really need to show us some code.  If your XML documents  
are small enough, then perhaps DOM (via JDOM) would be a much simpler  
way to navigate XML via XPath.

     Erik

On 24 Oct 2005, at 11:07, MALCOLM CLARK wrote:

>
> Hi all,
>
> I am relatively new and scared by Lucene so please don't flame me.I  
> have abandoned Digester and am now just using other SAX stuff.
>
> I have used the sandbox stuff to parse an XML file with SAX which  
> then bungs it into a document in a Lucene index.The bit I'm stuck  
> on is how is a elementBuffer split up into several items.I have a  
> elementBuffer with three 'article' documents but only shows as one  
> when using Luke to view the index?
>
> please advise.
>
> Thanks very much.
>
> MC
>
>


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


Re: indexwriter and index searcher

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi Malcolm,

--- MALCOLM CLARK <ma...@btinternet.com> wrote:

> Hi all,
>
> I am relatively new and scared by Lucene so please don't flame me.

I won't flame, but you just hijacked somebody else's thread.... baaad
boy!

> I have abandoned Digester and am now just using other SAX stuff.

No need to be afraid of Lucene nor SAX.  Have you got a copy of Lucene
in Action?  If not, consider getting at least a PDF version (cheaper)
and peeking at its code (free) - see http://lucenebook.com/ .  If you
look at chapter 7, you'll get most of the code you need for indexing
XML.

> I have used the sandbox stuff to parse an XML file with SAX which
> then bungs it into a document in a Lucene index.The bit I'm stuck on
> is how is a elementBuffer split up into several items.I have a
> elementBuffer with three 'article' documents but only shows as one
> when using Luke to view the index? 
> please advise.

I'm not sure what you are trying to do.... take look at LIA code.  If
that doesn't help, start a new thread, show the code, and somebody may
be able to provide some advice.

Otis

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


Re: indexwriter and index searcher

Posted by MALCOLM CLARK <ma...@btinternet.com>.
Hi all,

I am relatively new and scared by Lucene so please don't flame me.I have abandoned Digester and am now just using other SAX stuff.

I have used the sandbox stuff to parse an XML file with SAX which then bungs it into a document in a Lucene index.The bit I'm stuck on is how is a elementBuffer split up into several items.I have a elementBuffer with three 'article' documents but only shows as one when using Luke to view the index? 

please advise.

Thanks very much.

MC