我正在更新exists-db集合中的XML文件,我必须检查是否存在id以确定是否必须替换或插入文档中的内容.
我注意到随着文件的增长,查询执行时间显着恶化,我决定为我的文件添加一个索引.
我知道我必须在我的exists-db的conf.xml中这样做,因为它在这个例子中显示:
<!-- Range indexes -->
<create qname="title" type="xs:string"/>
<create qname="author" type="xs:string"/>
<create qname="year" type="xs:integer"/>
<!-- "old" context-dependant configuration using the path attribute: -->
<create path="//booktitle" type="xs:string"/>
Run Code Online (Sandbox Code Playgroud)
我想在xml中添加属性id的索引,如下所示:
<server>
<formal>
<lastimage>
<harvested>
<coverages>
<coverage active="true" id="EUDEM">
...
</coverage>
</coverages>
</harvested>
</lastimage>
</formal>
</server>
Run Code Online (Sandbox Code Playgroud)
我认为不会添加
<create qname="id" type="xs:string"/>
Run Code Online (Sandbox Code Playgroud)
足够.
在此属性的exists-db中添加和索引的正确方法是什么?
我正在尝试创建一个消息小部件,当用户单击其 div 时打开一条消息,并且每 30 秒刷新一次。
问题是小部件刷新后,单击功能停止工作。我猜这与设置点击时添加的新元素不存在的事实有关。我用萤火虫测试了它,如果我在重新加载后运行脚本,它会一直工作到下一次刷新。
有谁知道在 ajax 调用后重置类似内容的正确方法是什么?
我在下面包含我的咖啡脚本代码:
refreshPartial = ->
$.ajax url: "refresh-messages-feed"
$(document).ready ->
myElem = document.getElementById("messagesFeed")
setInterval refreshPartial, 30000 if myElem?
$(".conversation").click ->
url = "/conversations/small/" + $(this).attr("id")
console.log url
$.ajax
url: url
cache: false
success: (html) ->
$("#conversation").html html
Run Code Online (Sandbox Code Playgroud)