我有三个带有"userName"字段的文档:
当我搜索'brian'时,我按照预期得到了所有三个,但是当我搜索'briandilley'时,我仍然得到了所有三个回来.analyze API告诉我它在我的搜索字符串上使用了ngram过滤器,但我不确定原因.这是我的设置:
索引设置:
{
"analysis": {
"analyzer": {
"username_index": {
"tokenizer": "keyword",
"filter": ["lowercase", "username_ngram"]
},
"username_search": {
"tokenizer": "keyword",
"filter": ["lowercase"]
}
},
"filter": {
"username_ngram": {
"type": "edgeNGram",
"side" : "front",
"min_gram": 1,
"max_gram": 15
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
制图:
{
"user_follow": {
"properties": {
"targetId": { "type": "string", "store": true },
"followerId": { "type": "string", "store": true },
"dateUpdated": { "type": "date", "store": true },
"userName": {
"type": "multi_field",
"fields": {
"userName": { …Run Code Online (Sandbox Code Playgroud) 下面的代码似乎并不同时运行,我不确定为什么:
def run_normalizers(config, debug, num_threads, name=None):
def _run():
print('Started process for normalizer')
sqla_engine = init_sqla_from_config(config)
image_vfs = create_s3vfs_from_config(config, config.AWS_S3_IMAGE_BUCKET)
storage_vfs = create_s3vfs_from_config(config, config.AWS_S3_STORAGE_BUCKET)
pp = PipedPiper(config, image_vfs, storage_vfs, debug=debug)
if name:
pp.run_pipeline_normalizers(name)
else:
pp.run_all_normalizers()
print('Normalizer process complete')
threads = []
for i in range(num_threads):
threads.append(multiprocessing.Process(target=_run))
[t.start() for t in threads]
[t.join() for t in threads]
run_normalizers(...)
Run Code Online (Sandbox Code Playgroud)
的config变量只是的以外定义的词典_run()功能.似乎创建了所有进程 - 但它并不比使用单个进程更快地完成.基本上,run_**_normalizers()函数中发生的是从数据库中的队列表(SQLAlchemy)读取,然后发出一些HTTP请求,然后运行规范化器的"管道"来修改数据,然后将其保存回数据库.我来自JVM领域,其中线程"很重"并经常用于并行 - 我有点困惑,因为我认为多进程模块应该绕过Python的GIL的限制.
所以这里是Subversion,Jenkins,Beanstalk设置:
基本上我想要做的是:
这个想法是短冲刺,在每个结束时,一个开发循环结束并且qa循环开始.当qa循环完成时,它被推送到生产环境.
我想保留分支并从分支合并到\而不是删除和重新创建.这个想法是,在qa中进行的任何修复都将合并回介绍主干,并且在prod中进行的任何更改都将合并回qa(并返回到主干).
因此prod是一个"热门"分支,代表了生产环境的当前状态.
这是一个小团队的开发人员工作一周的冲刺.
问题:
我正在尝试使用PhotoView库为照片构建裁剪工具,但我无法理解返回的值getDisplayRect().我把照片设置在ImageView这样的:
photo.setImageDrawable(new BitmapDrawable(getResources(), image));
Run Code Online (Sandbox Code Playgroud)
imageBitmap对象在哪里.然后我设置了一些缩放值:
float minScale = ((float)image.getWidth() > (float)image.getHeight())
? (float)image.getWidth() / (float)image.getHeight()
: (float)image.getHeight() / (float)image.getWidth();
attacher.setMaxScale(minScale * 5f);
attacher.setMidScale(minScale * 2.5f);
attacher.setMinScale(minScale);
attacher.setScale(minScale, (float)image.getWidth() / 2f,(float)image.getHeight() / 2f, false);
attacher.update();
Run Code Online (Sandbox Code Playgroud)
其中attacher是PhotoViewAttacher对象.
当用户完成后,我使用以下内容来确定在以下位置可见的位图部分ImageView:
RectF rect = attacher.getDisplayRect();
float scale = attacher.getScale();
PhotoData ret = new PhotoData(data);
ret.x = (int)(Math.abs(rect.left) / scale);
ret.y = (int)(Math.abs(rect.top) / scale);
ret.width = (int)(rect.width() / scale);
ret.height = (int)(rect.height() …Run Code Online (Sandbox Code Playgroud) 我创建了一个自定义视图,其中TextView调用了子类TextViewEx.这个视图比通过xml Drawables可用的化合物增加了更多的灵活性TextView.我想要的部分功能是能够为复合绘图提供色彩,但无论出于何种原因,返回的颜色总是如此-1.这是代码:
attrs.xml:
<resources>
<declare-styleable name="TextViewEx">
<attr name="drawableLeftWidth" format="dimension" />
<attr name="drawableLeftHeight" format="dimension" />
<attr name="drawableLeftTint" format="color" />
<attr name="drawableTopWidth" format="dimension" />
<attr name="drawableTopHeight" format="dimension" />
<attr name="drawableTopTint" format="color" />
<attr name="drawableRightWidth" format="dimension" />
<attr name="drawableRightHeight" format="dimension" />
<attr name="drawableRightTint" format="color" />
<attr name="drawableBottomWidth" format="dimension" />
<attr name="drawableBottomHeight" format="dimension" />
<attr name="drawableBottomTint" format="color" />
</declare-styleable>
</resources>
Run Code Online (Sandbox Code Playgroud)
TextViewEx.java:
public class TextViewEx
extends TextView {
public TextViewEx(Context context) {
super(context);
init(null, 0);
} …Run Code Online (Sandbox Code Playgroud)