我有一个弹性搜索索引,我不能用映射设置每个字段,所以日期以字符串形式进行...
有谁知道我将如何排序该字符串日期?
我看过_script
{
"query" : {
....
},
"sort" : {
"_script" : {
"script" : "doc['field_name'].value",
"type" : "string",
"order" : "asc"
}
}
}
Run Code Online (Sandbox Code Playgroud)
但这失败了因为它的分析领域......
任何建议都会很棒!
谢谢
我有一个项目 - http://preloaders.net.我已对其进行设置,以便在Google搜索中显示评级(标题下方的橙色星标,例如尝试输入预加载器微调器关键字).一切都运行正常,除了主页,因为我刚修好它.
我现在将整个标记重新编码为HTML5(我很新),并使用schema.org并将所有产品包含在整个模式中,但我不知道schema.org中的Review-aggregate的替代品是什么,所以我正在尝试WebPage.Google网站管理员不会显示错误,但问题是:以下代码是否仍会显示明星或我应该执行其他操作?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>my title</title>
</head>
<body>
<nav>
<a href=""></a>
</nav>
<main>
<section>
<h1>AJAX LOADERS</h1>
<article itemscope itemtype="http://schema.org/Product">
<figure>
<img itemprop="image" src="/preloader.gif" alt="">
<figcaption itemprop="description">
Spinning Christmas tree with balls.
</figcaption>
</figure>
<a href="#" title="#" itemprop="url">
<h3 itemprop="name">3D Christmas tree </h3>
</a>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<span itemprop="priceCurrency" content="USD">$</span><span class="price" itemprop="price">2.95</span>
</div>
<div class="favorite"></div>
<div class="add-to-cart"></div>
<div class="frames-amount">30 fr</div>
<div class="dimensions">256x256</div>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
Average Rating: <span itemprop="ratingValue">5</span>
Votes: <span itemprop="ratingCount">12</span> …Run Code Online (Sandbox Code Playgroud) 我正在使用vhost它express来管理两个子域.一切正常,但我想通过ip过滤其中一个子域的请求.你知道这是否可行?
我试着在我的子域名网站的app.js来管理它,但req.connection.remoteAddress并req.ip给我的服务器的IP.
当我只有一个子域并且不使用vhost时我有正确的ip,但是因为我使用了vhost我已经得到了我服务器的ip ...
这是我之前的文件夹结构:
-- subdomain1/
-- app.js
-- views/
Run Code Online (Sandbox Code Playgroud)
这是我的新结构:
-- subdomain1/
-- app.js
-- views/
-- subdomain2/
-- app.js
-- views/
-- manageSubdomain/
-- app.js
Run Code Online (Sandbox Code Playgroud)
这是我的代码,它在使用vhost之前工作,并且只用于一个子域:
subdomain1/app.js:
var express = require('express');
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
require('body-parser-xml')(bodyParser);
var routes = require('./routes/index');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after …Run Code Online (Sandbox Code Playgroud) 我在页面上有元素,我想要动画来查看,但是在他们动画后,我想将它们的动画更多地推迟到CSS(通过改变类)...我发现Velocity留下我所有的动画style=标签中的属性使CSS转换不可能.
我在下面有一个解决方案,但重置CSS完成似乎不确定,我想知道是否有更好的方法来做到这一点?
// first use CSS to hide the element and squish it
$el.css({
width: 0,
left: "-10px",
opacity: 0,
marginRight: 0,
transition: "none"
})
// now animate the width and margin (do this first
// so there's a little gap between existing elements
// before we fade in new element.
.velocity({
width: width,
marginRight: margin
}, {
queue: false,
duration: 230
})
// then fade and move in the new element,
// but …Run Code Online (Sandbox Code Playgroud) 我有一个包含多个对象的数组.在该数组中,每个对象具有两个或更多个子对象.我想将所有子对象聚合成一个数据数组.如何使用javascript?
var array1 = [
{
"dfgasg24":{
name:"a",
id:1
},
"dfgare24":{
name:"b",
id:2
}
},
{
"wegasg24":{
name:"ab",
id:76
},
"yugasg24":{
name:"bc",
id:34
},
"yugasg26":{
name:"dc",
id:45
}
}
]
Run Code Online (Sandbox Code Playgroud)
我想要的输出是这样的,
var result = [
{
name:"a",
id:1
},
{
name:"b",
id:2
},
{
name:"ab",
id:76
},
{
name:"bc",
id:34
},
{
name:"dc",
id:45
}
];
Run Code Online (Sandbox Code Playgroud) 在打字稿中编码时遇到了一个奇怪的问题.不知何故2> 100 == true(?).
我真的没弄清楚......
这是我的代码:
if (!this.multipleYAxis) {
for (let d of this.getDatasources()) {
let options = this.getGraphTypeOption(d.id);
console.log(this.yMax + ' < ' + options.max);
console.log(this.yMax < options.max);
if (this.yMax < options.max)
this.yMax = options.max;
if (this.yMin > options.min)
this.yMin = options.min;
}
if (this.getChart().yAxis[1] != undefined) {
this.getChart().yAxis[1].update({
max: this.yMax
});
this.getChart().yAxis[1].update({
min: this.yMin
});
}
}
Run Code Online (Sandbox Code Playgroud)
yMin和yMax声明如下:
private yMin: number = 0;
private yMax: number = 0;
Run Code Online (Sandbox Code Playgroud)
options声明如下:
export interface GraphTypeOption {
...
max: number;
min: number; …Run Code Online (Sandbox Code Playgroud) javascript ×3
jquery ×2
animation ×1
arrays ×1
css ×1
date ×1
express ×1
html5 ×1
lodash ×1
node.js ×1
schema.org ×1
typescript ×1
velocity.js ×1