Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 60888 invoked from network); 6 Feb 2004 16:42:12 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 6 Feb 2004 16:42:12 -0000 Received: (qmail 16290 invoked by uid 500); 6 Feb 2004 16:41:47 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 16264 invoked by uid 500); 6 Feb 2004 16:41:47 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 16200 invoked from network); 6 Feb 2004 16:41:46 -0000 Received: from unknown (HELO c000.snv.cp.net) (209.228.32.84) by daedalus.apache.org with SMTP; 6 Feb 2004 16:41:46 -0000 Received: (cpmta 4521 invoked from network); 6 Feb 2004 08:41:48 -0800 Received: from 128.143.211.16 (HELO ?128.143.211.16?) by smtp.hatcher.net (209.228.32.84) with SMTP; 6 Feb 2004 08:41:48 -0800 X-Sent: 6 Feb 2004 16:41:48 GMT Mime-Version: 1.0 (Apple Message framework v612) In-Reply-To: <00c501c3ecbd$5827e710$0401a8c0@antioch> References: <00c501c3ecbd$5827e710$0401a8c0@antioch> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <5952EE4C-58C3-11D8-A28B-000393A564E6@ehatchersolutions.com> Content-Transfer-Encoding: 7bit From: Erik Hatcher Subject: Re: Query question Date: Fri, 6 Feb 2004 11:41:44 -0500 To: "Lucene Users List" X-Mailer: Apple Mail (2.612) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Everything you are doing looks ok to me. Next step is to run some sample text through something like the AnalyzerDemo.analyze method shown here: Be sure to use real world data, although "builder building" would be a good first pass to ensure all is working well then. If you are really searching for "build*" using the code you've shown (without the quotes!) then it should work from my quick look at what you've done. Erik On Feb 6, 2004, at 9:27 AM, Justin Woody wrote: > Hi Erik, > > Here is the IndexWriter with the Standard analyzer: > Class variable: IndexWriter writer; > > > writer = IndexWriter(indexDirectory, new StandardAnalyzer(), true); > > While looping over the ResultSet I call this method: > > private void indexDoc(ResultSet rs) throws Exception { > Document doc = new Document(); > > doc.add(Field.UnIndexed("value", rs.getString("value"))); > doc.add(Field.UnIndexed("name", rs.getString("name"))); > > doc.add(Field.UnStored("content",rs.getString("indexed"))); > > writer.addDocument(doc); > } > > The "indexed" data is a concatenation of the Code and Desciptor(s) > fields that they want to search by. They are concatenated with a space. > Ex. Select col1 as value, col2 as name, col3 || ' ' || col2 || ' ' || > col5 as indexed from tableName. Since there are many tables that are > similar in structure I wrote the queries like this so I could multi > thread the re indexing process on a frequent basis and use one generic > class. > > Here is my test search class: > > public IndexSearchTest(String search, String index) throws Exception { > String indexName = dirLucene + index +"/"; > System.out.println("Index Name " + indexName); > > IndexSearcher searcher = new > IndexSearcher(IndexReader.open(indexName)); > > Query query = QueryParser.parse(search.toUpperCase(), > "content", > new StandardAnalyzer()); > > Hits hits = searcher.search(query); > Document result; > System.out.println("Begin Search Results"); > for (int i=0;i result = hits.doc(i); > System.out.println("Key :" + result.get("value") + " Desc: > " > + result.get("name")) ; > } > System.out.println("Finished Search: " +hits.length()); > } > > Thanks in advance, > Justin > > -----Original Message----- > From: Erik Hatcher [mailto:erik@ehatchersolutions.com] > Sent: Thursday, February 05, 2004 6:34 PM > To: Lucene Users List > Subject: Re: Query question > > > On Feb 5, 2004, at 3:27 PM, Justin Woody wrote: >> If I search the index for "building" it comes back fine (2 records) or > >> "builder" (1record), but if I search for "build*" I only receive one >> record, in my example, the second record. The client would like all 3 >> records to come back. Is there a way I can make that happen? I've been > >> trying different query types and syntax, but haven't been able to >> succeed. > > We need more details to know what is going on. What analyzer are you > using with indexing? > > How are you building the query objects? QueryParser? Same Analyzer > as with indexer? > > (Succinct) code is the best :) > > Erik > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org