lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramesh Salla <ramesh.sa...@iptouch.com>
Subject Re: Searching multiple indexes
Date Mon, 26 Jun 2006 06:04:00 GMT
Hi,

use MultiFieldQueryParser instead of the Queryparser that you are using.
Like this,   

                                          String fields[]={field1,
field2,....}
					MultiFieldQueryParser parser = new MultiFieldQueryParser(fields,
new StopAnalyzer());
					Query query = parser.parse(.....);
					
QueryParser qp = new QueryParser("contents", new StopAnalyzer());

> Query query = qp.parse(findMe.toUpperCase());



good day......          bye         Ramesh Reddy


On Fri, 2006-06-23 at 18:15 -0400, Rod.Madden@ferguson.com wrote:

> I have "Tokenized" multiple items into one index directory as
> illustrated below.
>  
> I can successfully search on any one indexed field ( as illustrated
> below ) 
> ...the question is how would I search on all my indexed fields at one 
> ...any ideas ? I have heard of MultiSearch but I am not sure if that 
> is appropriate here .
>  
> Thanks,
>  
> Rod
>  
> // Build Index
>  
> Analyzer analyzer = new StopAnalyzer(COMBINED_STOP_WORDS);     
>   
> IndexWriter writer = new IndexWriter(dir, analyzer, true);
> .
> .
> Document doc = new Document();
> Field field = new Field("URI",
>                  "/someDir/someFile", 
>                  Field.Store.YES,
>                  Field.Index.TOKENIZED);
>  
> doc.add(field);
> Field field = new Field("SUMMARY",
>                  "this is a summary", 
>                  Field.Store.YES,
>                  Field.Index.TOKENIZED);
> doc.add(field);
> Field field = new Field("STATUS",
>                  "Success", 
>                  Field.Store.YES,
>                  Field.Index.TOKENIZED);
> doc.add(field);
> .
> .
> writer.addDocument(doc);
>  
> 
> // Search just URI index
> IndexSearcher is = new IndexSearcher(directory);
> QueryParser qp = new QueryParser("contents", new StopAnalyzer());
> Query query = qp.parse(findMe.toUpperCase());
> Hits hits = is.search(query);
>  
> // Search the URI, SUMMARY and STATUS indexes
> ??
>  

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message