SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Users

Thread: Compass & Ibatis

This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 31 - Pages: 3 [ 1 2 3 | Next ] - Last Post: Nov 29, 2011 1:18 AM Last Post By: north face clea...
Youen CHENE

Posts: 3
Registered: 6/2/08
Compass & Ibatis
Posted: Jun 2, 2008 12:02 PM
 
  Click to reply to this thread Reply
hi everybody,

I am looking for a full sample which how to integrate compass and ibatis order to query search on table manage by ibatis.

Does anyone got something like that ?

I tried many search on the net (google, googlecodesearch, this forum, groups, blogs) but the only ressource is the small sample from the doc....

Thanks,
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Compass & Ibatis
Posted: Jun 3, 2008 12:45 PM   in response to: Youen CHENE in response to: Youen CHENE
 
  Click to reply to this thread Reply
I don't have one ready, but you can find a very simple example in Compass test code that tests the iBatis integration.
Youen CHENE

Posts: 3
Registered: 6/2/08
Re: Compass & Ibatis
Posted: Jun 3, 2008 2:45 PM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
Ok, I'll give a try on friday, I'll send feedback this week end I hope.
Youen CHENE

Posts: 3
Registered: 6/2/08
Re: Compass & Ibatis
Posted: Jun 9, 2008 3:22 PM   in response to: Youen CHENE in response to: Youen CHENE
 
  Click to reply to this thread Reply
Ok, it is a simple I can understand and make work the search feature I was looking for.

For the Ibatis developer who want to know here it is a small help:

I supposed you already have setup your sqlMap connection and you already have your Ibatis Object/table mapping XML file ready.

Now you need to create your Compass mapping File:


<!DOCTYPE compass-core-mapping PUBLIC "-//Compass/Compass Core Mapping DTD 2.0//EN" "http://www.compass-project.org/dtd/compass-core-mapping-2.0.dtd">

<compass-core-mapping package="YOUR PACKAGE">
<class name="YOUR OBJECT" alias="ALIAS YOU DEFINE">
<id name="id" />

<property name="shortDescription">
<meta-data>shortDescription</meta-data>
</property>

<property name="description">
<meta-data>description</meta-data>
</property>

+ ADD YOUR PROPERTY YOU WANT +

</class>
</compass-core-mapping>


Then create a compass config XML file:



<!DOCTYPE compass-core-configuration PUBLIC
"-//Compass/Compass Core Configuration DTD 2.0//EN"
"http://www.compass-project.org/dtd/compass-core-configuration-2.0.dtd">

<compass-core-configuration>
<compass>
<setting name="compass.engine.connection">target/test-index</setting>
<mapping resource="THE MAPPING XML FILE" />
</compass>
</compass-core-configuration>


Now, the java code:


CompassConfiguration cpConf = new CompassConfiguration().configure("/Compass_Config.xml");
compass = cpConf.buildCompass();
compass.getSearchEngineIndexManager().deleteIndex();
compass.getSearchEngineIndexManager().verifyIndex();
compassGps = new SingleCompassGps(this.getCompass());
compassDeviceProduct = new SqlMapClientGpsDevice("sqlMap", sqlMap, new String[] { "QUERY FROM YOUR IBATIS FILE OF THE OBJECT" });
compassGps.addGpsDevice(compassDeviceProduct);

compassGps.start();

compassGps.index();

CompassSession cs= compass.openSession();

CompassTransaction tx=cs.beginTransaction();

try{

//CompassQueryBuilder q=cs.queryBuilder();

CompassHits h=cs.find(searchstring); //

System.out.println("query OK");

Iterator<CompassHit> it=h.iterator();
while (it.hasNext())
{
CompassHit hit=(CompassHit) it.next();
System.out.println("Hit :");
System.out.println(" "+hit.toString());
System.out.println(" "+hit.getAlias());
System.out.println(" "+hit.alias());
System.out.println(" "+hit.getScore());
System.out.println(" "+((BOProduct) hit.getData()).getId());
System.out.println(" "+((BOProduct) hit.getData()).getShortDescription());
}

tx.commit();
}
catch(Exception e)
{
tx.rollback();
}

cs.close();

compassGps.stop();


That's all !

Now, i need to understand how to optimize compass my web app. Do y need to do the .start(), .index() .stop() at each times ? How do I optimize ? How does it works when update & insert query are done in the database ?

Does anyone know where I can find the help I need ?

Edited by: Youen CHENE on Jun 9, 2008 11:18 PM

Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Compass & Ibatis
Posted: Jun 10, 2008 5:34 PM   in response to: Youen CHENE in response to: Youen CHENE
 
  Click to reply to this thread Reply
A few notes:

1. Don't call deleteIndex every time. This will delete your index when the application starts up...
2. Index is (as you note) a possible heavy operation. It executes the select configured and *re*index all the data.

If you want changes done using iBatis to be reflected in the index using Compass, you will need to mirror the same operations you do using iBatis (save, delete, update, ...) on Compass as well.
louisvuittonbox

Posts: 411
Registered: 8/23/11
Re: Compass & Ibatis
Posted: Aug 23, 2011 9:35 PM   in response to: Youen CHENE in response to: Youen CHENE
 
  Click to reply to this thread Reply
Welcome to louis vuitton online! Here at our online shop, we enable you to select as many styles louis vuitton bags as you can at greatly discounted prices. Established in 2006, We have already landed so many returning customers from louis vuitton outlet. We have been known for the authentic quality of our items,such as louis vuitton belts and louis vuitton purses unsurpassed customer service, rapid delivery, unique prices and so on and so forth. What we did, are doing and will do is only to make our esteemed customers consume those world-renowned luxury designer merchandise with peace of mind. So we sincerely hope that you could be our next returning customer. We are confident that you will be quite satisfied with everything we offer here. Wish you a very good shopping louis vuitton store!
clothworld

Posts: 1,130
Registered: 11/16/11
Columbia Jackets
Posted: Nov 20, 2011 6:30 PM   in response to: Youen CHENE in response to: Youen CHENE
 
  Click to reply to this thread Reply
I discovered that I am an expert at talking about what I do all day because I know what I am doing, I am good at what I Columbia Jackets am doing, and I love what I am doing. I know how I feel Columbia Jacket about teaching and can easily explain Columbia Jackets On Sale what my beliefs are. I am confident that I run my Womens Columbia Interchange Jacket classroom in an efficient way and I know that I am trying my hardest to see that every child grows to their highest potential. Talking about my teaching is easy for me Special Columbia Jackets because it’s what I was meant to do.It’s so perfect for my New Columbia Jackets drive to work– the episodes are short and amusing. Both ladies are pretty awkward, but that’s Columbia Rain Jacket part of what makes it so awesome. By awkward, I mean amazing, because being awkward is the Columbia Womens Jacket best. They talk about the most random stuff (like their cats and their most embarrassing moments), and basically they just laugh at themselves the All Columbia Jackets whole time. A good amount of time I find myself chucking a long, which is a perfect way to start Columbia 2011 my morning and Mens Columbia Interchange Jacket a great way to unwind at the end of the day.
clothworld

Posts: 1,130
Registered: 11/16/11
Columbia Jackets
Posted: Nov 20, 2011 6:35 PM   in response to: Youen CHENE in response to: Youen CHENE
 
  Click to reply to this thread Reply
I discovered that I am an expert at talking about what I do all day because I know what I am doing, I am good at what I Columbia Jackets am doing, and I love what I am doing. I know how I feel Columbia Jacket about teaching and can easily explain Columbia Jackets On Sale what my beliefs are. I am confident that I run my Womens Columbia Interchange Jacket classroom in an efficient way and I know that I am trying my hardest to see that every child grows to their highest potential. Talking about my teaching is easy for me Special Columbia Jackets because it’s what I was meant to do.It’s so perfect for my New Columbia Jackets drive to work– the episodes are short and amusing. Both ladies are pretty awkward, but that’s Columbia Rain Jacket part of what makes it so awesome. By awkward, I mean amazing, because being awkward is the Columbia Womens Jacket best. They talk about the most random stuff (like their cats and their most embarrassing moments), and basically they just laugh at themselves the All Columbia Jackets whole time. A good amount of time I find myself chucking a long, which is a perfect way to start Columbia 2011 my morning and Mens Columbia Interchange Jacket a great way to unwind at the end of the day.
Legend
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums