Elasticsearch analyzer配置(Elasticsearch analyzer config)
我想为Elasticsearch中的任何索引设置一个全局分析器。
这些行被添加到elasticsearch.yaml中:
index.analysis.analyzer.ik.type: ik index.analysis.analyzer.default.type: ik index.analysis.analyzer.standard.type: ik
重新启动Elasticsearch后,这些行显示在http:// localhost:9200 / _nodes / settings中
index: { analysis: { analyzer: { standard: { type: "ik" }, default: { type: "ik" }, ik: { type: "ik" } } } }
然后我测试了url http:// localhost:9200 / _analyze?text =时间&analyzer = ik
{ tokens: [ { token: "时间", start_offset: 0, end_offset: 2, type: "CN_WORD", position: 0 } ] }
它显示IKAnalyzer已启用。 但是,当涉及http:// localhost:9200 / _analyze?text =时间&analyzer = standard或http:// localhost:9200 / _analyze?text =时间时,将返回“标准”分析器结果:
{ tokens: [ { token: "时", start_offset: 0, end_offset: 1, type: "<IDEOGRAPHIC>", position: 0 }, { token: "间", start_offset: 1, end_offset: 2, type: "<IDEOGRAPHIC>", position: 1 } ] }
所以我该怎么做?
I want to set a global analyzer for any index in Elasticsearch.
These lines are added into elasticsearch.yaml:
index.analysis.analyzer.ik.type: ik index.analysis.analyzer.default.type: ik index.analysis.analyzer.standard.type: ik
After restarting Elasticsearch, these lines are shown in http://localhost:9200/_nodes/settings
index: { analysis: { analyzer: { standard: { type: "ik" }, default: { type: "ik" }, ik: { type: "ik" } } } }
Then I tested with url http://localhost:9200/_analyze?text=时间&analyzer=ik
{ tokens: [ { token: "时间", start_offset: 0, end_offset: 2, type: "CN_WORD", position: 0 } ] }
It shows the IKAnalyzer is enabled. However, when it comes to http://localhost:9200/_analyze?text=时间&analyzer=standard or http://localhost:9200/_analyze?text=时间, the "standard" analyzer results are returned:
{ tokens: [ { token: "时", start_offset: 0, end_offset: 1, type: "<IDEOGRAPHIC>", position: 0 }, { token: "间", start_offset: 1, end_offset: 2, type: "<IDEOGRAPHIC>", position: 1 } ] }
So, what should I do?
原文:https://stackoverflow.com/questions/38412057
最满意答案
实施您自己的时间轴面板。 它很容易!
面板允许您通常为其子项控制布局。 例如,ItemsControl公开了一个名为ItemsPanel的属性,该属性的类型为ItemsPanelTemplate。 默认情况下,这个ItemsPanelTemplate包含一个垂直StackPanel,但可以用你真棒的时间轴面板覆盖。 它们对任何时间轴的关键是x坐标。
使用下面的代码计算你的x坐标是战斗的一半。 之后,只需确定重叠,您就可以在时间轴上正确堆叠项目。
Avanade Silverlight加速器具有时间轴控制和StackCalendar控件(想想Gannt图表),它非常好用。
public double ScaleDate(DateTime date) { TimeSpan span = this.StopDate - this.StartDate; TimeSpan pos = date - this.StartDate; double posDays = double.Parse(pos.Days.ToString()); double spanDays = double.Parse(span.Days.ToString()); double x = posDays / spanDays; return x; }
Implement your own Timeline Panel. Its quite easy!
Panels allow you to control layout generically for its children. The ItemsControl for example exposes a property called ItemsPanel that is of type ItemsPanelTemplate. By default this ItemsPanelTemplate contains a vertical StackPanel but can be overridden with your awesome Timeline Panel. They key to any timeline is the x-coordinate.
Using the code below to calculate your x coordinate is half the battle. After that its just a matter of determining overlap so you can properly stack your items on the timeline.
The Avanade Silverlight Accelerator has both a Timeline Control and a StackCalendar Control (think Gannt Chart) which work very nicely.
public double ScaleDate(DateTime date) { TimeSpan span = this.StopDate - this.StartDate; TimeSpan pos = date - this.StartDate; double posDays = double.Parse(pos.Days.ToString()); double spanDays = double.Parse(span.Days.ToString()); double x = posDays / spanDays; return x; }
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
DispatcherTimer和UI刷新限制在C#silverlight中(DispatcherTimer and UI refresh limits in C# silverlight)[2023-09-19]
我认为这里的关键是意识到Silverlight默认以60fps的最大帧速率渲染(通过MaxFrameRate属性进行定制)。 这意味着DispatcherTimer ticks每秒最多会触发60次。 此外,所有的渲染工作都发生在UI线程上,因此DispatcherTimer会根据上一张海报中指出的最好的速度触发绘图。 添加三个定时器的结果就是每个事件循环激发“添加数据”方法3次,而不是一次,所以它看起来像你的图表要快得多,但实际上帧速率是大致的一样。 您可以通过一个DispatcherTimer获得相同的效 ... -
实施您自己的时间轴面板。 它很容易! 面板允许您通常为其子项控制布局。 例如,ItemsControl公开了一个名为ItemsPanel的属性,该属性的类型为ItemsPanelTemplate。 默认情况下,这个ItemsPanelTemplate包含一个垂直StackPanel,但可以用你真棒的时间轴面板覆盖。 它们对任何时间轴的关键是x坐标。 使用下面的代码计算你的x坐标是战斗的一半。 之后,只需确定重叠,您就可以在时间轴上正确堆叠项目。 Avanade Silverlight加速器具有时间轴控制和S ...
-
WPF应该能够很容易地处理这个问题。 Silverlight可能会工作,但它没有WPF提供的相同硬件加速,因此性能会更低。 实际实施有很多选择。 您可以使用画布并自己渲染。 或者,如果您遇到更新问题,画布网格(仅根据需要更新)可能有助于保留模式渲染系统执行得更好,但我怀疑,使用标准屏幕分辨率,您会遇到任何问题WPF中的这一数量的文本。 WPF should be able to handle this, pretty easily. Silverlight would probably work, but ...
-
建立声音的频率需要将信号从时域转换到频域。 它将涉及傅立叶变换和随后的输出分析。 如果没有对DSP技术的全面了解,对任何人来说,这都不是一项工作。 如果你不得不问,那么你自己实现这一目标还有很长的路要走。 我推荐第三方库。 这个页面提供了一个从频率检测新手的相当好的视图。 Establishing the frequency of the sound requires converting the signal from the time domain to the frequency domain. It ...
-
我认为这是对您的问题的一个很好的描述: http : //microapplications.com/blog/archive/2009/04/18/329.aspx 实际上,您可以创建一个包含作业,图像和审计属性的新类,并从DomainService返回它。 在服务器端,你拼凑了一些LINQ代码,它们将从所有3个表中选择相关项。 这只是一个解决方案,你可能还可以在你的selectionchanged处理程序中编写一些代码,只加载与相关作业相关的图像。 I think this is a good desc ...
-
C#Silverlight - 如何访问我设置为“资源”的文件?(C# Silverlight - How do I access a file that I set as a “resource”?)[2023-11-02]
从Silverlight的角度来看,“嵌入式资源”和“资源”之间的区别在于Silverlight无法访问“嵌入式资源”,因此请勿使用它。 要访问作为“资源”添加到dll程序集的文件,您需要添加程序集的名称加上“; component”作为访问它的Uri的第一个元素: - spellChecker.MainDictionary.LoadAsync(new Uri("/yourProjectName;component/yourDictionary.dic",UriKind.Relative)); 如果您正 ... -
C#Silverlight MediaElement不会从网上播放mp3(C# Silverlight MediaElement wont play mp3 from web)[2022-05-30]
我看到您在示例中使用了实际的URL。 我检查了您的网站,没有http://www.sm-testing.co.uk/ClientAccessPolicy.xml文件或http://www.sm-testing.co.uk/crossdomain.xml文件。 没有这些文件中的任何一个( 最好是ClientAccessPolicy.xml,因为另一个是旧的Flash兼容格式并缺少某些功能)Silverlight只会从托管的域中检索文件。 这是一项安全功能,可以阻止Silverlight应用程序在未经许可的情况 ... -
C#Silverlight Equivlant of Windows Form Method?(C# Silverlight Equivlant of Windows Form Method?)[2023-11-09]
Silverlight没有同步Socket方法。 您将需要使用Socket.ReceiveAsync方法 。 这里的好例子: 使用套接字将数据推送到Silverlight客户端 。 [编辑]做这样的事情的基本想法: var e = new SocketAsyncEventArgs(); e.Completed += SocketReceiveCompleted; Socket.ReceiveAsync(e); private void SocketReceiveCompleted(object sende ...