Hi everybody,
I've a problem with my searching index.
I've created a stand alone application and it works perfectly.I've put
them on tomcat launching with java web start but If I run the query(the
same query) I always obtain no result!!!!please help me!!!
Marco Lazzara
Il giorno lun, 18/05/2009 alle 09.43 -0500, Eric LeVin ha scritto:
> Apparently it was because I needed to actually look at the method
> signature a bit closer :) not reassigning my indexReader instance would
> mean I was always using the first instance created which wouldn't have
> the documents in them. Thanks again for your help!
>
> -Eric LeVin
>
> balasubramanian sudaakeran wrote:
> > Hi Eric LeVin,
> > I think whenever you reopen the indexReader you have to re-create
> > indexSearcher also. This is because reopen of indexReader will give you a
> > new instance if the underlying data is changed.
> >
> > Function documentation for IndexReader.reopen
> > * If the index has not changed since this instance was (re)opened, then
> > this
> > * call is a NOOP and returns this instance. Otherwise, a new instance is
> > * returned. The old instance is <b>not</b> closed and remains usable.<br>
> > * <b>Note:</b> The re-opened reader instance and the old instance might
> > share
> > * the same resources. For this reason no index modification operations
> > * (e. g. {...@link #deleteDocument(int)}, {...@link #setNorm(int,
> > String, byte)})
> > * should be performed using one of the readers until the old reader
> > instance
> > * is closed. <b>Otherwise, the behavior of the readers is undefined.</b>
> > * <p>
> >
> >
> >
> >
> > ----- Original Message ----
> > From: Eric LeVin <[email protected]>
> > To: [email protected]
> > Sent: Monday, May 18, 2009 7:30:47 PM
> > Subject: Problems searching index
> >
> > Hi Everyone--
> > So I'm not quite sure what is going on with my Lucene index, but I'm
> > having some issues searching. I've created a simple little index of 10
> > documents as follows:
> >
> > id: 1
> > type: Article
> > content: <<some content>>
> >
> > ....
> >
> > id: 10
> > type: Article
> > content: <<other content>>
> >
> > So I created a simple TermQuery for starters that would pull back all of my
> > Article types:
> >
> > BooleanQuery bq = new BooleanQuery();
> > bq.add(new TermQuery(new Term(FIELD_TYPE, "Article")), Occur.MUST);
> >
> > I realize that I could simply do a TermQuery, but I want to be able to add
> > additional content constraints after I get this working. So here is where
> > my confusion comes in:
> >
> > If I run the query against my IndexSearcher, I get 0 results; however, if I
> > run it as a delete on the IndexWriter, I can open it in Luke and see the
> > entire index deleted. So why would the writer be finding documents and the
> > searcher wouldn't? As a note, whenever I am adding documents, I am calling
> > reopen() on the reader. Here is how I'm creating the
> > writer/reader/searcher:
> >
> > KeywordAnalyzer ka = new KeywordAnalyzer();
> > analyzer.addAnalyzer(FIELD_ID, ka);
> > analyzer.addAnalyzer(FIELD_TYPE, ka);
> > analyzer.addAnalyzer(FIELD_CONTENT, contentAnalyser);
> > indexWriter = new IndexWriter(directory, analyzer, true,
> > MaxFieldLength.UNLIMITED);
> > indexReader = IndexReader.open(directory);
> > indexSearcher = new IndexSearcher(indexReader);
> >
> > Any thoughts? Thanks so much for all the help!
> >
> > -Eric LeVin
> >
> > ---------------------------------------------------------------------
> > 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]