lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Infinite Tester" <infinitelimittes...@gmail.com>
Subject Re: Concurrent Indexing + Searching
Date Fri, 01 Feb 2008 22:46:57 GMT
Thanks Mark!

Option D looks great. Regarding that option,  I have couple of questions
based on my first glance at the code ( more specifically SimpleSearchServer
)

1) I should be calling release of writer and searcher after every call. Is
it always mandatory in cases like searcher, when I am sure that I havn't
written anything since the last search ?

2) Based on 1), is it okay to cache the instance of writer and Searcher
object locally ?

3) Are there any plans to push these to the trunk? Also, are there any
blocking/critical issues  before we can start using it in production ?


Thanks!



On Feb 2, 2008 3:41 AM, Mark Miller <markrmiller@gmail.com> wrote:

> You are not seeing the doc because you need to close the IndexWriter
> first.
>
> To have an interactive index you can:
>
> A: roll your own.
> B: use Solr.
> C: use the original LuceneIndexAccessor
> https://issues.apache.org/jira/browse/LUCENE-390
> D: use my updated IndexAccessor
> https://issues.apache.org/jira/browse/LUCENE-1026
>
> I have actually just added the ability to warm searchers before putting
> them into to use for option D, but i havn't gotten around to posting the
> new code yet.
>
>
> - Mark Miller
>
>
>
>
> codetester wrote:
> > Hi All,
> >
> > A newbie out here.... I am using lucene 2.3.0. I need to use lucene to
> > perform live searching and indexing. To achieve that, I tried the
> following
> >
> > FSDirectory directory = FSDirectory.getDirectory(location);
> > IndexReader reader = IndexReader.open(directory );
> > IndexWriter writer = new IndexWriter(directory , new SimpleAnalyzer(),
> > true); // <- I want to recreate the index every time
> > IndexSearcher searcher = new IndexSearcher( reader );
> >
> > For Searching, I have the following code
> > QueryParser queryParser = new QueryParser("xyz", new
> StandardAnalyzer());
> > Hits hits = searcher .search(queryParser.parse(displayName + "*"));
> >
> > And for adding records, I have the following code
> >  // Create doc object
> >  writer.addDocument(doc);
> >
> >  IndexReader newIndexReader = reader.reopen() ;
> >  if ( newIndexReader != reader ) {
> >        reader.close() ;
> >  }
> >  reader = newIndexReader ;
> >  searcher.close() ;
> >  searcher = new IndexSearcher(reader );
> >
> > So the issues that I face are
> >
> > 1) The addition of new record is not reflected in the search ( even
> though I
> > have reinited IndexSearcher )
> >
> > 2) Obviously, the add record code is not thread safe. I am trying to
> close
> > and update the reference to IndexSearcher object. I could add a sync
> block,
> > but the bigger question would be that what is the ideal way to achieve
> this
> > case where I need to add and search record real-time ?
> >
> > Thanks !
> >
> >
> >
> >
> >
>
>  ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message