首页 \ 问答 \ solr对空索引字段的行为如何?(How solr behaves for empty index fields?)

solr对空索引字段的行为如何?(How solr behaves for empty index fields?)

我在solr架构中有许多索引字段。 其中一些是定期填写索引内容到solr。 但其中一些是有条件填充的,例如如果字段名在源中可用,请将其编入索引并将其填入索引字段,否则将其留空。

Solr在这些场景中的表现如何。 我是否在solr索引中获取有/无值的所有字段,或者我只会看到那些非空的索引字段。 我认为后来的情况应该成立。

问候。


I have a number of index fields in solr schema. Some of these are filled on regular basis on indexing content into solr. But some of these are filled conditionally such as if field name is available in source, index it and fill it in index field otherwise leave it empty.

How solr behaves in these scenarios. Do i get all fields with/without values in solr index or i will see only those index fields which are non-empty. I think later scenario should hold true.

Regards.


原文:
更新时间:2022-03-16 19:03

最满意答案

您必须使用[]方括号来转义格式字符串中的字符,请参阅format文档:

要转义格式字符串中的字符,可以将字符包装在方括号中。

此外请注意,目前没有EEEE令牌,但单个E代表星期几(ISO) ,因此在您的情况下,您将拥有2222 。 使用dddd获取所需的输出。

这是一个工作示例:

var date = '2017-01-02';
var format = 'dddd, D [de] MMMM [de] YYYY';
console.log(moment(date).format(format));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/pt.js"></script>


You have to use [] square brackets to escape characters in format string, see format docs:

To escape characters in format strings, you can wrap the characters in square brackets.

Moreover note that there is no EEEE token in moment, but the single E represents Day of Week (ISO), so in your case you will have 2222. Use dddd to get the desidered output.

Here a working example:

var date = '2017-01-02';
var format = 'dddd, D [de] MMMM [de] YYYY';
console.log(moment(date).format(format));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/pt.js"></script>

相关问答

更多
  • 如文档中所述, “Moment的解析器非常宽容”,因此: moment("14-Apr random text", "DD-MMM"); 将被解释为有效日期( 2016-04-14 )。 As stated in the docs "Moment's parser is very forgiving" so: moment("14-Apr random text", "DD-MMM"); will be interpreted as a valid date (2016-04-14).
  • 只需使用令牌,请参阅format()文档。 请注意,您必须使用小写mm来获得分钟,而大写MM则需要数月。 import * as moment from 'moment'; ngOnInit() { moment(1503491583*1000).format('MM/DD/YYYY H:mm a'); } 你得到pm3/p3因为am/pm被解释为: a => am或pm (根据您的情况而定) m作为分钟(在你的情况下为3 ) p作为p字符 作为旁注,片刻具有moment.unix(Number)方法 ...
  • 要确保您正确解析字符串,您希望将期望的字符串格式传递给momentjs(类似这样): const IsoDateTo = moment(dateTo,'DD/MM/YYYY').format('YYYY-MM-DD[T]HH:mm:ss'); To make sure that you are correctly parsing the string you want to pass the expected string format along to the momentjs (something l ...
  • Views \ Shared \ EditorTemplates,创建名为CoreDateToShortDateString的新局部视图。 使用此代码: @ModelType System.Decimal? @If Model IsNot Nothing Then Dim datum As DateTime If DateTime.TryParseExact(Model.Value.ToString, "yyyyMMdd", Nothing, Globalization.DateTimeStyles ...
  • 嗯......这很奇怪: 这有效: moment("YYYY-MM-DD HH:mm ZZ", moment().format("YYYY-MM-DD HH:mm ZZ")) moment("YYYY-MM-DD HH:mm ZZ", "2014-02-04 07:47 +0800") +moment("YYYY-MM-DD HH:mm ZZ", "2014-02-04 07:47 +0800") 但这不起作用: moment( "YYYY-MM-DD HH:mm ZZ", ...
  • 根据文件 : 因此, _d的值以及以_ _d任何其他属性不应用于任何目的。 话虽如此,我们可以解释发生了什么。 在你的情况下,我们可以看到_i和_f都被设置。 _i似乎被用来存储你传递给时刻的初始值。 _f看起来存储您告诉的时刻解析输入的格式。 看这里: var m = moment('2017/10/04 12:34:56', 'YYYY/MM/DD'); console.log(m._i); console.log(m._f); console.log(m.format('YYYY-MM-DD H ...
  • 如何创建一个新的时刻对象以将其传递到管道中,如: let newMomentObj = moment(job.createdAt, 'DD-MM-YYYY'); 并在您的HTML文件中: {{ newMomentObj | amTimeAgo }} What about creating a new moment object to pass it into the pipe, like: let newMomentObj = m ...
  • 您需要告诉您日期字符串的格式是什么时候: moment('20171206T062406927Z', 'YYYYMMDD[T]HHmmssSSSZ', true).format('D-MMM-YYYY'); 编辑:根据@VincenzoC注释更新,以确保以UTC格式解析时间戳 还修复:使用HH 24小时格式(而不是hh ),并传递第三个true参数,以确保时间戳在严格模式下解析。 You need to tell moment which format your date string is in: mo ...
  • 这不是我期望的日期操作库。 您需要解码数据,执行迭代以查找日期,然后使用片刻进行日期记录,最后将数据重新编码回所需的表单。 也就是说,看看你想要什么似乎是一项非常微不足道的任务。 这样的事情应该为你做 JavaScript的 var jsonString = '[{"name":"Jammer0","SystemDate":"2013-05-06T17:19:40.443","LocalDate":"2013-05-06T18:19:40"},{"name":"Jammer1","SystemDate":" ...
  • 您必须使用[]方括号来转义格式字符串中的字符,请参阅format文档: 要转义格式字符串中的字符,可以将字符包装在方括号中。 此外请注意,目前没有EEEE令牌,但单个E代表星期几(ISO) ,因此在您的情况下,您将拥有2222 。 使用dddd获取所需的输出。 这是一个工作示例: var date = '2017-01-02'; var format = 'dddd, D [de] MMMM [de] YYYY'; console.log(moment(date).format(format));

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)