lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Pannell <steven.pann...@zooplus.com>
Subject RE: QueryParser over multiple fields
Date Thu, 29 Dec 2005 14:50:38 GMT
Hi,

You can also do it like this:

QueryParser.parse("(summary:DOG OR title:DOG)", "title", getAnalyzer());

QueryParser.parse("(summary:DOG AND title:DOG)", "title", getAnalyzer());

The "title" is the default column, so no need to reference in the
queryString eg:

QueryParser.parse("(summary:DOG OR DOG)", "title", getAnalyzer());

Steve.


-----Original Message-----
From: Gaston [mailto:gasi@artentis.com]
Sent: 29 December 2005 13:42
To: java-user@lucene.apache.org
Subject: QueryParser over multiple fields


Hallo,


in my index every document consistsof multiple fields like 
url,contents,description etc.I want to search for documents in the url 
and the contents field.
My problem is that the constructor of QueryParser only provide one field 
like "Query query=QueryParser.parse("query",field1,analyzer);"
Is there an oppurtinity to construct an query Object like "Query 
query=QueryParser.parse("query",field1,field2,analyzer);" to provide a 
search over field1 and field2 ?
I solved this problem in a very unelegant way I think because I 
introduced two searching procedures in my application, one for field1 
and the another one for field2. But this is very bad for the performance 
because the application has to search two times.

I am glad about every suggestion


Greetings


Gaston


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message