esme-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xuefeng Wu <ben...@gmail.com>
Subject lucene search(Compass) at ESME
Date Sun, 15 Nov 2009 15:10:58 GMT
Hi,

I'm sorry I'm busy these days and didn't do anything about ESME except keep
an eye on.

Today I have free time and try to resolve
ESME-101<https://issues.apache.org/jira/browse/ESME-101>.

I learned compass some hours and try to find out why the Search is broken.
But fail to resolve the defects.

I have a question:
I think Compass should know how to access the data but I didn't find any
configure for this.
Compass provide solution that could integrate with hibernate,JPA,JDBC ect.
Did we need CompassGps?


I'm not family with JPA with Lift, I use JDBC Gps, but failed too, I think
maybe I miss something....

I added such as:
 val conf = tryo(new CompassConfiguration()
      .configure(Props.get("compass_config_file") openOr
"/props/compass.cfg.xml")
      .addClass((new Message).clazz))

      def dataSource(): DataSource= {
        println("Create datasrouce")
        val bds: BasicDataSource = new BasicDataSource();
        bds.setDriverClassName("com.mysql.jdbc.Driver");
        bds.setUrl("jdbc:mysql://localhost/esme");
        bds.setUsername("esme");
        bds.setPassword("esme");
        bds
   }

  val mapping = {
      val _mapping: ResultSetToResourceMapping = new
ResultSetToResourceMapping();
    _mapping.setAlias("message");
    _mapping.setSelectQuery("select m.id as id, m.text as text, m.source as
source from esme.message m");
    // maps from a parent_id column to a resource property named parent-id
    _mapping.addIdMapping(new IdColumnToPropertyMapping("id", "id"));
    _mapping.addDataMapping(new DataColumnToPropertyMapping("text",
"text"));
    _mapping.addDataMapping(new DataColumnToPropertyMapping("source",
"source"));
    _mapping
    }

  private val ismr: InputStreamMappingResolver = {

    val ri: ResultSetResourceMappingResolver = new
ResultSetResourceMappingResolver()
    ri.setDataSource(dataSource)
    ri.setMapping(mapping)
    println(ri)
    ri
  }

  val compass = conf.map(cf => {
                          try{cf.addMappingResover(ismr)}catch{case _ =>
println} ......

-- 
Scala中文社区:  http://groups.google.com/group/scalacn

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message