简体   繁体   English

在Algolia索引中搜索第二级数据集

[英]Search through second level data sets in an Algolia Index

I have the following Algolia index imported from firebase database and I can search through everything on Algolia dashboard 我有以下从Firebase数据库导入的Algolia索引,可以在Algolia仪表板上搜索所有内容 在此处输入图片说明

but when in the search box on my website I can't search through "inventory". 但是在我网站的搜索框中时,我无法搜索“库存”。 these are some of my codes 这些是我的一些代码

   //configure algolia
 var index = algolia.initIndex('Businesses');

  var businessRef = database.ref("/Businesses");


   businessRef.on('child_added', addOrUpdateIndexRecord);
   businessRef.on('child_changed', addOrUpdateIndexRecord);
   businessRef.on('child_removed', deleteIndexRecord);

index settings 索引设定

      index.setSettings({
    searchableAttributes: [
      'NSN',
      'PartNumber',
      'ProductDescription',
      'ProductName',
      'Inventory',
    ],
    customRanking: ['desc(NSN)'],

    function(err, content) {
      console.log(content);
    }

  })

client 客户

    client.initIndex('Inventory').setSettings({
      "searchableAttributes": [
        'NSN',
      'PartNumber',
      'ProductDescription',
      'ProductName',
      'Inventory'
      ],
      customRanking: [
        'desc(NSN)'
      ],
      function(err, content) {
          console.log(content);
        }
    });

front end 前端

    <script type="text/html" id="hit-template">
              <div class="hit">

                <div class="hit-content">
                <h2 class="hit-name">  {{{_highlightResult.NSN.value}}}</h2>
                  <p class="hit-description">{{{_highlightResult.ProductName.value}}}</p>
                </div>
              </div>
            </script>

What I want to do is to search through only inventory from the search box. 我想做的是仅在搜索框中搜索库存。 How can I do this ? 我怎样才能做到这一点 ?

can you also provide your search query parameters and front-end client options? 您还可以提供搜索查询参数和前端客户端选项吗?

Did you add inventory attribute to the searchableAttributes settings? 您是否将inventory属性添加到searchableAttributes设置中?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM