Could you provide some examples of the data in the untokenized fields? At first glance there really is no need to use a PhraseQuery for the untokenized fields - a simple term query would suffice for that case.
How should your clauses be grouped? Like: (<searchTerm1> AND < searchTerm2>) OR (< searchTerm3> AND < searchTerm4>) Or: <searchTerm1> AND (< searchTerm2> OR < searchTerm3>) AND < searchTerm4> You can create a BooleanQuery with other BooleanQueries as clauses to group them as desired. Michael -----Original Message----- From: Sudhanya Chatterjee [mailto:[EMAIL PROTECTED] Sent: Thursday, May 08, 2008 12:09 AM To: lucene-net-user@incubator.apache.org Subject: RE: AND OR operators for untokenized fields We are creating the query in the following way - For tokenized fields - QueryParser queryParse = new QueryParser(field, new StandardAnalyzer())); Query qry = queryParse.Parse(field + ":" + searchTerm); bq.Add(qry, BooleanClause.Occur.SHOULD); //bq is the Boolean query For Untokenized fields - PhraseQuery queryPhrase = new PhraseQuery(); queryPhrase.SetSlop(0); queryPhrase.Add(new Term(field, searchTerm.Trim().ToLower())); bq.Add(queryPhrase, BooleanClause.Occur.SHOULD); //bq is the Boolean query In the above two situations how to construct queries of the following type - <searchTerm1> AND < searchTerm2> OR < searchTerm3> AND < searchTerm4> Thanks, Sudhanya -----Original Message----- From: Jokin Cuadrado [mailto:[EMAIL PROTECTED] Sent: Thursday, May 08, 2008 12:18 PM To: lucene-net-user@incubator.apache.org Subject: Re: AND OR operators for untokenized fields i'm not very sure of what are your needs, but if queryparser don't suit them, you can always construct the query programatically. On 5/8/08, Sudhanya Chatterjee <[EMAIL PROTECTED]> wrote: > Hi, > > > > In our application we are adding multiple fields to lucene document while > indexing. > > Analyzer used is StandardAnalyzer. > > Few fields are tokenized and few untokenized. > > While searching QueryParser returns proper results for fields which are > tokenized and not for untokenized. > > We also need to support AND , OR operators in search phrase. > > With QueryParser these operators are supported. > > For untokenized fields the queries are created using phraseQuery. > > We need to support AND OR operators for all fields. > > How to achieve this? > > > > Thanks, > > Sudhanya > > > DISCLAIMER > ========== > This e-mail may contain privileged and confidential information which is the > property of Persistent Systems Ltd. It is intended only for the use of the > individual or entity to which it is addressed. If you are not the intended > recipient, you are not authorized to read, retain, copy, print, distribute > or use this message. If you have received this communication in error, > please notify the sender and delete all copies of this message. Persistent > Systems Ltd. does not accept any liability for virus infected mails. > DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.