【发布时间】:2014-04-16 12:02:55
【问题描述】:
我使用 solr4.7 和 CoreContainer 创建核心,使用 EmbeddedSolrServer 进行连接,使用 ModifiableSolrParams 获取数据..
我已经配置了 "solrconfig.xml" 和 requestHelper "import" 来导入数据和其他配置文件进行数据配置如下......
<dataConfig>
<dataSource driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/koupon"
user="root"
password="root" />
<document>
<entity name="koupon"
query="SELECT k.kouponid as kid, k.name, k.image,k.description,k.discount as discount,
k.startdate,k.enddate,k.actualamount,
k.discountamount,k.discountamount, c.name as category
FROM koupon.koupon k
INNER JOIN koupon.category c on c.categoryid = k.categoryid
where
k.startDate = NOW()
AND c.isActive=true AND c.isDeleted=false AND k.isActive =true AND lower(k.status)=lower('approved')
order by k.kouponid">
<field column="kid" name="kid"/>
<field column="name" name="name"/>
<field column="image" name="image"/>
<field column="description" name="description"/>
<field column="startdate" name="startdate"/>
<field column="enddate" name="enddate"/>
<field column="actualamount" name="actualamount"/>
<field column="discountamount" name="discountamount"/>
<field column="discount" name="discount"/>
<field column="category" name="category"/>
</entity>
</document>
</dataConfig>
在此代码中,使用 "k.startDate <= NOW() and endDate >= NOW()" 在记录之间获取,但 solr 查询不提供此功能。
我有一个解决方案,开始“到”结束,但这不是确切的解决方案..
我对这个问题感到非常厌倦,有人知道吗?如何解决这个问题?
【问题讨论】:
-
您是遇到错误还是没有结果?
-
当我使用“k.startDate = NOW()” 时出现错误,例如与元素类型“实体”关联的属性“查询”的值不得包含“