Karsten's saying that prefix and wildcard queries require a bunch of work. Specifically, Lucene assembles a list of all terms that match the query and then, conceptually at least, forms a huge OR query with one clause for each term. Say, for instance, you have the following values indexed in a field in any number of documents. aaaaa aaaa aaa aa a
Now you search for a*. Underneath the covers, Lucene behaves as if you submitted a query aaaaa OR aaaa OR aaa OR aa OR a which can rapidly grow to a query of thousands of clauses. Avoiding this is a good thing <G>. Best Erick On Mon, Aug 18, 2008 at 12:58 PM, <[EMAIL PROTECTED]> wrote: > > Karsten, > > Thanks for the feedback. Not sure I understand the reasoning behind not > using the "XXXX" prefix (do you have a link possibly?). But I see what > you are getting at with the additional field. I'll give it a try. > Thanks for the help. > > regards, > > Bill > > > -----Original Message----- > From: Karsten F. [mailto:[EMAIL PROTECTED] > Sent: Monday, August 18, 2008 11:45 AM > To: java-user@lucene.apache.org > Subject: Re: Testing for field existence > > > Hi Bill, > > you should not use prefix-query (XXXX*), because in first step lucene > would > generate a list of all terms in this field, and than search for all this > terms. Which is senceless. > > I would suggest to insert a new field "myFields" which contains as value > the > names of all fields for this document. > So instead of > +foo:XXXX* > you would search for > +myFields:foo > > This would be very fast. > > Best regards > > Karsten > > > Bill.Chesky wrote: > > > > Hello, > > > > I am creating fields for documents like this: > > > > > > > > String name = ... > > > > String value = ... > > > > doc.add(new Field(name, value, Field.Store.NO, > > Field.Index.UN_TOKENIZED)); > > ... > > > > One thing I tried is to change my field creation statement like this: > > > > > > doc.add(new Field(name, "XXXX" + value, Field.Store.NO, > > Field.Index.UN_TOKENIZED)); > > > > > > then do a query like this: > > > > > > +foo:XXXX* > > > > > > > > > > -- > View this message in context: > http://www.nabble.com/Testing-for-field-existence-tp19032939p19034359.ht > ml<http://www.nabble.com/Testing-for-field-existence-tp19032939p19034359.html> > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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] > >