-
simple search engine
i'm working on a simple search engine, which should be able to search for a word or phrase in my database. and bring out related topics. my problem is that i can search for a word but that of a phrase or sentence does not work. i tried using the split() in java then pass it to an array so i find by each word but a finder methods parameter can not be of type array. can anyone help me with a solution
-
"...but a finder methods parameter can not be of type array."
What does that mean?
And some code to give us an idea of what you're actually doing might help (don't forget the code tags).
-
in the code below.the 'findbyparts' cannot accept an array as the parameter. i want to be able to break up a phrase into each word in the sentence and search my DB word by word. thanks
public ArrayList viewbyParts(String problem) {
//TODO implement viewbyParts
Collection col=null;
String WILDCARD = "%";
String []s=null;
Iterator i=null;
ArrayList list=new ArrayList();
EngineLocal el=null;
try{s = problem.split(" ");
col=elh.findByParts(problem);
for (int j=0; j<s.length; j++){
System.out.println("The parts are "+s[j]);
}
i=col.iterator();
while(i.hasNext()){
el=(EngineLocal)i.next();
list.add(new searchHelper(el.getSno(),el.getProblems()));
}
}catch(Exception e){
e.getMessage();
}
return list;
}
-
Not knowing what findByParts does, or what it is expecting, I can't really help can I?
I don't even know what class it's a part of, but looking at the code I'm guessing it's some non-Sun API. So my first question would be, why not rewrite findByParts?
And you forgot the code tags...