Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

question about Compass

  Asked By: Fahimah    Date: Jun 29    Category: Java    Views: 466
  

I have a project which should perform file searching by file content.
I should do it with Compass version 2.2.
spring is my application framework and I use Hibernate in my db layer.

does anybody work with Compass? please give me an example.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Milind Mishra     Answered On: Jun 29

Compass aim is to integrate with different data sources (different ORM
frameworks).
If you want to index file  contents , It`s suited that use core lucene (with tika
to extraxt file contents).

there are some good examples and source codes here : http: // www . manning .
com/hatcher3/LIAsourcecode.zip

 
Answer #2    Answered By: Jamie Williams     Answered On: Jun 29

Have you read the doc ? , You find some examples hear www.compass-project.org/.../samples-library.html

 
Answer #3    Answered By: Darrell Harvey     Answered 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.

 
Didn't find what you were looking for? Find more on question about Compass Or get search suggestion and latest updates.




Tagged: