Thanks for your reply,
my original code snippet is
IndexSearcher searcher = new IndexSearcher(indexDir);
Analyzer analyzer = new StopAnalyzer();
BooleanClause.Occur[] flags = { BooleanClause.Occur.SHOULD,
BooleanClause.Occur.SHOULD,
BooleanClause.Occur.SHOULD,
BooleanClause.Occur.SHOULD,
BooleanClause.Occur.SHOULD };
// for multiple keyword search
Query query = MultiFieldQueryParser.parse(qryStr, new String[] {
"title", "path", "contents", "summary", "size"
}, flags,
analyzer);
Hits hits = getHits(qryStr, searcher, query, "path");
for (int inc = 0; inc < hits.length(); inc++) {
Document doc = hits.doc(inc);
///////
}
// private method to get hits by using phrase query
private Hits getHits(String qryStr, Searcher searcher, Query queryNorm,
String phraseQryTerm) throws Exception {
Hits hits = null;
// for single word search
PhraseQuery queryPhrase = new PhraseQuery();
queryPhrase.setBoost(4.0f);
queryPhrase.setSlop(1);
queryPhrase.add(new Term(phraseQryTerm, qryStr.toLowerCase()));
hits = searcher.search(queryPhrase);
return hits;
}
if i use this code for my search , it gives me the unwanted search hits ,
as i mentioned , if i search for "about us" , this is an example ,
there may be more number of urls like this , for example , "credit cards" ,
"book marks" , how do i handle it ?
--
View this message in context:
http://www.nabble.com/Searching-doubt-tp24802552p24803560.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]