首页 \ 问答 \ 根据字段分组结果 - Lucene(Groupping results based on fields - Lucene)

根据字段分组结果 - Lucene(Groupping results based on fields - Lucene)

我正在使用Lucene 4.10.4。 我想从20个不同的领域以非常有效的方式获得“n个结果”,而无需搜索20次。 如果我使用布尔查询搜索,我们可能会在单个搜索中获得所有结果。 我想根据字段对结果进行分组,是否有任何分组概念?


I'm using Lucene 4.10.4. I want to take "n results" from 20 different fields in an efficient way without searching 20 times. If I search using boolean query, we might get all the results in single search. I want to group results based on fields, is there any grouping concept?


原文:https://stackoverflow.com/questions/42291516
更新时间:2024-05-19 19:05

最满意答案

您可以使用nodeJs中提供的“http”模块发出http请求,然后处理从api调用收到的响应。 请看下面的例子

var http = require('http');

var options = {
   host: 'example.com',
   port: 80,
   path: '/foo.html'
};

http.get(options, function(resp){
   resp.on('data', function(chunk){
   //do something with chunk
  });
}).on("error", function(e){
   console.log("Got error: " + e.message);
}); 

You can use "http" module available in nodeJs to make http request and then process the response recieved from the api call. Look at the below example

var http = require('http');

var options = {
   host: 'example.com',
   port: 80,
   path: '/foo.html'
};

http.get(options, function(resp){
   resp.on('data', function(chunk){
   //do something with chunk
  });
}).on("error", function(e){
   console.log("Got error: " + e.message);
}); 

相关问答

更多
  • 不推荐由量角器的当前维护者: https://github.com/angular/protractor/issues/9#issuecomment-19927049 量角器和业力不能一起使用; 而是提供单独的运行测试系统。 量角器和因果关系覆盖测试的不同方面 - 因果关系主要用于单元测试,而量角器应用于端到端测试。 量角器构建在WebDriverJS之上,WebDriverJS使用Selenium / WebDriver服务器来配置浏览器并驱动测试执行。 纯WebDriverJS的例子可以在这里找到: h ...
  • 您可以使用Protractor测量角度2应用 (从量角器2.5.0开始)。 对于量角器5.0.0+ ,您不必做任何具体操作, 量角器将自动检测在测试应用程序中使用的角度版本 。 对于量角器> = 2.5.0和<= 4.0.14,您只需要在您的配置中添加useAllAngular2AppRoots: true 。 这是一个例子 。 请注意,几个内置的量角器匹配器将不会与Angular2一起使用,请参阅: 量角器角度2失败:未知错误:角度未定义 在Firefox中还存在量角器+ Angular2问题(仍未解决) ...
  • 你可以将对$resource的调用放入一个使用Protractor的browser.addMockModule()模拟出来的服务吗? 这样,Protractor将始终覆盖您的原始服务,然后才有机会运行。 这可能看起来像 // in your application myModule.service('myNotificationService', function($resource) { this.notification = $resource('/notification').get(); }); ...
  • 这已经有一段时间了,但我已经通过以下辅助方法成功测试了带有量角器的Ionic: waitForIonic: function () { //Register a promise with protractor, so the browser waits for it var deferred = protractor.promise.defer(); let clickBlock = element(by.css('.click-block-active')); //if ...
  • 是的, expect() ,如果与Protractor ,可以理解承诺 - 它可以在做出预期之前解决一个承诺,使编写Protractor测试更容易。 这实际上是在Protractor依赖的单独项目中完成的jasminewd2 修补 jasmine的expect()以解析promises并包装jasmine的describe() , it()和其他测试控制块函数在Control Flow中执行。 请注意,它还支持断言双方的 promise,您可以这样做,例如: let elementText1 = $('.n ...
  • AngularJS V1.6版本附带了一个比平常更长的更改列表。 为了给你一个提醒,下面简要总结一下预计会产生最大影响的重大变化。 确保您在下面的完整列表中查看它们或查看相应的提交以获取更多信息。 $ location现在使用'!' 作为hash-bang URL的默认哈希前缀,而不是空字符串。 $ compile将(默认情况下)不预先为组件/指令控制器实例分配绑定。 由于安全原因,http对JSONP请求施加了额外的限制 对input [type = range]的改进支持意味着范围输入(绑定到ngMod ...
  • 您可以使用nodeJs中提供的“http”模块发出http请求,然后处理从api调用收到的响应。 请看下面的例子 var http = require('http'); var options = { host: 'example.com', port: 80, path: '/foo.html' }; http.get(options, function(resp){ resp.on('data', function(chunk){ //do something with ...
  • Protractor是一个非常强大的工具,用于测试您的应用程序,验证,导航甚至CRUD操作(创建,读取,更新和删除)。 例如,我正在为角度应用程序开发端到端测试,我会完成用户应该经历的每一步,并检查它可能出错的地方。 如果用户输入了错误的电子邮件,验证是否会出现? 您可以生成每次启动网站的新版本时运行的测试列表。 Protractor is a very powerful tool to test your application, validation, navigation or even CRUD-o ...
  • 我认为你在这里有一个范围问题。 使用protractor ,您可以通过自动执行用户操作(点击,输入键,悬停等),从最终用户角度通过浏览器中打开的用户界面从一端到另一端测试应用程序。 要测试函数,您应该查看AngularJS单元测试 。 I think you have a scoping problem here. With protractor, you test your application from one end to another from an end-user perspective t ...
  • 我不确定这是否正是您正在寻找的,但您可以在Protractor中定义模拟服务,然后使用Protractors browser.addMockModule函数将它们上传到浏览器。 上传的模块将替换应用程序通常使用的真实模块。 有关更多详细信息,请参阅以下博文。 http://eitanp461.blogspot.com/2014/01/advanced-protractor-features.html I am not sure if this is exactly what you are looking ...

相关文章

更多

最新问答

更多
  • 您如何使用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)