lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Rod.Mad...@ferguson.com>
Subject Searching multiple indexes
Date Fri, 23 Jun 2006 22:15:06 GMT
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