<legend id='V33ba'><style id='V33ba'><dir id='V33ba'><q id='V33ba'></q></dir></style></legend>
  • <tfoot id='V33ba'></tfoot>
    1. <small id='V33ba'></small><noframes id='V33ba'>

      <i id='V33ba'><tr id='V33ba'><dt id='V33ba'><q id='V33ba'><span id='V33ba'><b id='V33ba'><form id='V33ba'><ins id='V33ba'></ins><ul id='V33ba'></ul><sub id='V33ba'></sub></form><legend id='V33ba'></legend><bdo id='V33ba'><pre id='V33ba'><center id='V33ba'></center></pre></bdo></b><th id='V33ba'></th></span></q></dt></tr></i><div id='V33ba'><tfoot id='V33ba'></tfoot><dl id='V33ba'><fieldset id='V33ba'></fieldset></dl></div>

        <bdo id='V33ba'></bdo><ul id='V33ba'></ul>

        从 Lucene Query 获取不同值的更快方法

        时间:2023-09-14
        <legend id='G2PtU'><style id='G2PtU'><dir id='G2PtU'><q id='G2PtU'></q></dir></style></legend>
      1. <i id='G2PtU'><tr id='G2PtU'><dt id='G2PtU'><q id='G2PtU'><span id='G2PtU'><b id='G2PtU'><form id='G2PtU'><ins id='G2PtU'></ins><ul id='G2PtU'></ul><sub id='G2PtU'></sub></form><legend id='G2PtU'></legend><bdo id='G2PtU'><pre id='G2PtU'><center id='G2PtU'></center></pre></bdo></b><th id='G2PtU'></th></span></q></dt></tr></i><div id='G2PtU'><tfoot id='G2PtU'></tfoot><dl id='G2PtU'><fieldset id='G2PtU'></fieldset></dl></div>
        <tfoot id='G2PtU'></tfoot>

        • <bdo id='G2PtU'></bdo><ul id='G2PtU'></ul>

              <tbody id='G2PtU'></tbody>

                  <small id='G2PtU'></small><noframes id='G2PtU'>

                  本文介绍了从 Lucene Query 获取不同值的更快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  目前我喜欢这样:

                  IndexSearcher searcher = new IndexSearcher(lucenePath);
                  Hits hits = searcher.Search(query);
                  Document doc;
                  List<string> companyNames = new List<string>();
                  
                  for (int i = 0; i < hits.Length(); i++)
                  {
                      doc = hits.Doc(i);
                      companyNames.Add(doc.Get("companyName"));
                  }
                  searcher.Close();
                  
                  companyNames = companyNames.Distinct<string>().Skip(offSet ?? 0).ToList();
                  return companyNames.Take(count??companyNames.Count()).ToList();
                  

                  如您所见,我首先收集所有字段(数千个)然后区分它们,可能会跳过一些并取出一些.

                  As you can see, I first collect ALL the fields (several thousands) and then distinct them, possibly skip some and take some out.

                  我觉得应该有更好的方法来做到这一点.

                  I feel like there should be a better way to do this.

                  推荐答案

                  老实说,我不确定是否存在,因为 Lucene 不提供独特"的功能.我相信使用 SOLR 您可以使用构面搜索来实现这一点,但是如果您想在 Lucene 中实现这一点,则必须自己编写某种构面功能.所以只要你没有遇到任何性能问题,你应该没问题.

                  I'm not sure there is, honestly, as Lucene doesn't provide 'distinct' functionality. I believe with SOLR you can use a facet search to achieve this, but if you want this in Lucene, you'd have to write some sort of facet functionality yourself. So as long as you don't run into any performance issues, you should be ok this way.

                  这篇关于从 Lucene Query 获取不同值的更快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:随着时间的推移,随着索引和文档数量的增加,elasticsearch 批量索引会变慢 下一篇:Windows 窗体中的提示对话框

                  相关文章

                    <bdo id='n0u3M'></bdo><ul id='n0u3M'></ul>

                  <legend id='n0u3M'><style id='n0u3M'><dir id='n0u3M'><q id='n0u3M'></q></dir></style></legend>

                • <i id='n0u3M'><tr id='n0u3M'><dt id='n0u3M'><q id='n0u3M'><span id='n0u3M'><b id='n0u3M'><form id='n0u3M'><ins id='n0u3M'></ins><ul id='n0u3M'></ul><sub id='n0u3M'></sub></form><legend id='n0u3M'></legend><bdo id='n0u3M'><pre id='n0u3M'><center id='n0u3M'></center></pre></bdo></b><th id='n0u3M'></th></span></q></dt></tr></i><div id='n0u3M'><tfoot id='n0u3M'></tfoot><dl id='n0u3M'><fieldset id='n0u3M'></fieldset></dl></div>
                • <tfoot id='n0u3M'></tfoot>

                      <small id='n0u3M'></small><noframes id='n0u3M'>