Hi all,

I'm having a problem searching for phrases (example: "bucky badger"). I can search for the terms individually (using and or or searches (booleanquery)), but can't seem to do a phrasequery (within the same boolean query)....see code:

BooleanQuery myquery = new BooleanQuery();

for (int i = 0; i < keyword_vector.size(); i ++) {
keyword = (String)keyword_vector.elementAt(i);

//if the user has entered a wildcard at the end of the keyword
if (keyword.endsWith("*")){
myquery.add(new PrefixQuery(new Term("rest", keyword.substring(0, keyword.length() -1))), require_all, false);

//user is looking for an exact phrase.....enclosed w/ quotes
} else if (keyword.startsWith("\"") && keyword.endsWith("\"")){
//remove the quotes
keyword = keyword.substring(1, keyword.length() - 1);
PhraseQuery pq = new PhraseQuery();
pq.add(new Term("rest", keyword));
pq.setSlop(new Integer((String)properties.get("PhraseSlop")).intValue());
myquery.add(pq, require_all, false);

//just looking for a simple term
} else {
myquery.add(new TermQuery(new Term("rest", keyword)), require_all, false);
}
}


If I'm storing the "rest" field using Field.text(String, Reader) could this be the problem since it's not storing the index verbatim? If not, where should I be looking



Thanks for your previous help....getting VERY close to moving to production,
Dominic
madison.com

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to