Please start a new thread for a new question. And you need to provide more info. Here's a wild guess: your tomcat app is looking at a different index from your standalone app.
-- Ian. On Mon, May 18, 2009 at 5:26 PM, Marco Lazzara <marco.lazz...@gmail.com> wrote: > 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 results!!!Why?? > help Me!!!thanks a lot!! > > Marco Lazzara > > 2009/5/18 Eric LeVin <ejlevin1....@gmail.com> > >> 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 <ejlevin1....@gmail.com> >>> To: java-user@lucene.apache.org >>> 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: java-user-unsubscr...@lucene.apache.org >>> For additional commands, e-mail: java-user-h...@lucene.apache.org >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >>> For additional commands, e-mail: java-user-h...@lucene.apache.org >>> >>> >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org