You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Romain Laboisse <rl...@opsys.fr> on 2005/03/08 11:33:58 UTC

Searching multiple fields with same name

Hello,

I am indexing documents which may have more than one title and I would like
to be able to search these titles separately.
For example, a document may have two titles, "Jakarta Lucene" and "Powerful
search engine".
A search on 'lucene AND jakarta' should return this document but a search on
'lucene AND search' should not return it.

Is there a way to achieve this?

Thanks,
Romain
 


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


Re: Searching multiple fields with same name

Posted by Claude Libois <cl...@guest.minfin.fed.be>.
Why not use the MultiFieldQueryParser(look at
http://jakarta.apache.org/lucene/docs/api/org/apache/lucene/queryParser/MultiFieldQueryParser.html)?
This one allow you to specify on which field the search will be done.  I
think that for your example 'lucene AND jakarta' will be transform by the
parser into (+Title1:Lucene  +Title1:search) (+Title2:Lucene
+Title2:search).
Claude Libois


----- Original Message ----- 
From: "Romain Laboisse" <rl...@opsys.fr>
To: <lu...@jakarta.apache.org>
Sent: Tuesday, March 08, 2005 11:33 AM
Subject: Searching multiple fields with same name


> Hello,
>
> I am indexing documents which may have more than one title and I would
like
> to be able to search these titles separately.
> For example, a document may have two titles, "Jakarta Lucene" and
"Powerful
> search engine".
> A search on 'lucene AND jakarta' should return this document but a search
on
> 'lucene AND search' should not return it.
>
> Is there a way to achieve this?
>
> Thanks,
> Romain
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Searching multiple fields with same name

Posted by Jose Miguel Diez <jm...@microgenesis.es>.
Hello,

Just store it in two separate fields, and prepare a query:
 (title1:  myquery ) OR (title2: myquery )

Substitution of myquery by your expressions will work fine.

Saludos,
Jose Miguel

Romain Laboisse escribió:

>Hello,
>
>I am indexing documents which may have more than one title and I would like
>to be able to search these titles separately.
>For example, a document may have two titles, "Jakarta Lucene" and "Powerful
>search engine".
>A search on 'lucene AND jakarta' should return this document but a search on
>'lucene AND search' should not return it.
>
>Is there a way to achieve this?
>
>Thanks,
>Romain
> 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
>
>  
>


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.6.4 - Release Date: 07/03/2005


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