Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Fahimah Khan   on Jun 29 In Java Category.

  
Question Answered By: Darrell Harvey   on Jun 29

i did it from the compass reference.
text indexing was done well, but i can't retrieve the text. in fact, the search method return nothing.
here is my search method code:

public List<E> search(String query) {
CompassSearchSession session = getSearchSession();

CompassHits hits = session.find(query);

if (hits == null || hits.length() == 0) {
logger.info("Search content  found nothing with [" + query + "].");
return new ArrayList<E>();
}

logger.debug("Content search with [" + query + "] hits with size: " + hits.length());
List<E> result = new ArrayList<E>();

for (Iterator<CompassHit> i = hits.iterator(); i.hasNext();) {
CompassHit hit = i.next();
E entity = processSearchHit(hit);
logger.info("Search hit [" + hit + "] processed to entity with id: " + entity);
result.add(entity);
}

session.close();
return result;
}

i send a word ( like "hello" ) to the method as string param, but "session.find(query)" find nothing.
i don't know what is wrong.

Share: