laravel - 如何在MathML中将Elasticsearch用于索引公式?

标签 laravel elasticsearch mathjax mathml

我有一个问答网站,在该网站上使用Elasticsearch,还使用MathML键入公式。例如

<math xmlns="http://www.w3.org/1998/Math/MathML">
    <mi>d</mi>
    <mi>e</mi>
    <mi>t</mi>
    <mo> </mo>
    <mi>A</mi>
    <mo>≠</mo>
    <mn>0</mn>
</math>
det A ≠ 0的MathML代码。
问题在于elasticsearch像简单文本(不是公式)一样对其进行索引,因此搜索“det”的结果一无是处。

最佳答案

您的MathML在语义上对您正在做的事情不正确。它的意思不是det A ≠ 0,而是d * e * t A ≠ 0;那是det后跟A ≠ 0的乘积(我不确定空的<mo>代表什么,但是MathML会忽略该空格。)
更好的表示是

<math xmlns="http://www.w3.org/1998/Math/MathML">
    <mi>det</mi>
    <mo>&#x2061;</mo>
    <mi>A</mi>
    <mo>≠</mo>
    <mn>0</mn>
</math>
这也可以解决搜索问题,因为现在det将匹配某些内容。

关于laravel - 如何在MathML中将Elasticsearch用于索引公式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63875775/

相关文章:

ios - iOS uiwebview 中的 MathJax 显示白框

javascript - Vee validate v3 ValidationObserver 不与使用 v-for 添加的动态验证提供程序一起工作

php - Laravel 和 Azure 错误 : Internal Server Error

php - Laravel 5 配置文件中的自定义配置文件访问

ruby-on-rails - elasticsearch模型更新到7.0破坏测试

python - MathJax SVG 未验证

php - Laravel 加载关系 - 框架错误?

elasticsearch - 限制聚合处理的结果数量

elasticsearch - logstash转换为日期,并且仅在kibana中使用日期部分

javascript - MathJax 渲染时左对齐