lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tate Jones <t...@pisoftware.com>
Subject Re: Multiple field searching
Date Wed, 20 Mar 2002 23:28:19 GMT
Thanks for all your help.

The only way i could get it to work was the following

      BooleanQuery bQuery = new BooleanQuery();

      TermQuery tSubject   = new TermQuery( new Term( SUBJECT_KEY, subject ));
      TermQuery tKeyword = new TermQuery( new Term( KEYWORD_KEY,  keyword ));

      bQuery.add( tSubject, true, false );
      bQuery.add( tkeyword, true, false );

      Query qContent = QueryParser.parse( literal, CONTENT_KEY, analyzer );
      bQuery.add( qContent, false, false );

      //Perform query
      hits = indexSearcher.search(bQuery);

      // debug logging
      if (logger.isDebugEnabled()) {

        logger.debug("Searching the fulltext string index pool with '" +
          bQuery.toString(CONTENT_KEY)+"'" );
      }

Could not see how the MultiFieldQueryParser could take in multiple queries. ie.  SUBJECT,
KEYWORD & CONTENT field
have different values to be queried.  It only takes a single query.

On Wed, 20 Mar 2002 17:58, Otis Gospodnetic wrote:
> I'm using MultiTermQueryParser and it works for me.
>
> Otis
>
> --- Tate Jones <tate@pisoftware.com> wrote:
> > hi,
> >
> > I am trying to search across multiple fields using the following
> > query
> >
> > +keyword:computers +subject:News content:xml
> > or
> > +(keyword:{computers}) +(subject:{News}) content:xml
> >
> > i have added the fields to the document correctly.
> >
> > Have also tried using the MutipleFieldQueryParser without success.
> >
> > The only query that works is, which is not correct as they are OR's
> > keyword:computers subject:IT content:xml
> >
> > Is anyone having the same problems
> >
> > Thanks in advance
> > Tate
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:lucene-user-help@jakarta.apache.org>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message