You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by codejunky codejunky <co...@yahoo.com> on 2006/10/06 21:02:56 UTC

How do I search multiple text fields in Lucene .NET?

I'm assuming the Java and .NET versions are very similar. I have a title and description field and I want to search both to return documents. I use a booleanQuery but the content only successfully searches one field at a time. Is there something in addition that I need to do. Here's some sample code.
   
   
  queryField = QueryParser.Parse(sKeyword," title", this.standardAnalyzer);
  booleanQuery.Add(queryField, true, false);
   
  queryField = QueryParser.Parse(sKeyword,"description", this.standardAnalyzer);
  booleanQuery.Add(queryField, true, false);
   
  hits = indexSearcher.Search(booleanQuery);
   
  thanks, 
   Thomas

 		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

Re: How do I search multiple text fields in Lucene .NET?

Posted by Ernesto De Santis <de...@yahoo.com.ar>.
Hi

It's a question for lucene list.
I don't understand very well as you need, and which lucene version are 
using (.net or java)
Looking your code, I understand that the contents must match with both 
queries in boolean query. Because you use required = true. Then it's 
like an booleanQuery = titleQuery AND descripcionQuery.

Ernesto.

codejunky codejunky escribió:
> I'm assuming the Java and .NET versions are very similar. I have a title and description field and I want to search both to return documents. I use a booleanQuery but the content only successfully searches one field at a time. Is there something in addition that I need to do. Here's some sample code.
>    
>    
>   queryField = QueryParser.Parse(sKeyword," title", this.standardAnalyzer);
>   booleanQuery.Add(queryField, true, false);
>    
>   queryField = QueryParser.Parse(sKeyword,"description", this.standardAnalyzer);
>   booleanQuery.Add(queryField, true, false);
>    
>   hits = indexSearcher.Search(booleanQuery);
>    
>   thanks, 
>    Thomas
>
>  		
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.407 / Virus Database: 268.13.0/465 - Release Date: 06/10/2006
>   

	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas