首页 \ 问答 \ Lucene搜索返回不同的结果(Lucene search return different results)

Lucene搜索返回不同的结果(Lucene search return different results)

我的Java EE应用程序使用Lucene 4.在Lucene索引中,我有1000万人的全名。 当我使用搜索时,Lucene会返回不同的结果。 相同的应用程序在Windows上的开发环境,AIX上的测试环境中工作正常,但在生产服务器上,Lucene搜索返回的记录少得多。 相同的查询在开发中返回800结果,在生产时返回20个结果。 我们将在生产中尝试AIX和Red Hat,但仍然没有运气。

我将Lucene索引文件从生产复制到开发环境,并使用相同的应用程序搜索相同的查询:在我的环境中一切正常,有800个结果。 我启动应用程序调试,将Lucene查询复制为文本,并在我的环境中使用此查询与Luke - 有800个结果。 生产负载很高,我会尝试加载开发环境,但Lucene工作稳定,总是返回800。

哪里可以找到问题的根源?


My Java EE application uses Lucene 4. In Lucene index I have full name of 10 millions peoples. When I use search, Lucene returns different results. Same app works fine in development environment on Windows, test environment on AIX, but on production server Lucene search returns much less records. Same query returns 800 results in development and 20 results on production. We'll try AIX and Red Hat on production, but still no luck.

I copied Lucene index files from production to development environment, and has searched same query with same application: in my environment all works fine, there is 800 results. I start app with debug, copied Lucene query as text and use this query with Luke in my environment - have 800 results. There is high load on production, I'll try to load development environment, but Lucene works stable and always return 800.

Where to find the source of the problem?


原文:https://stackoverflow.com/questions/22008500
更新时间:2022-03-16 20:03

最满意答案

是的,如果您的平台上有可用的UI_GET_SYSNAME (在/usr/include/linux/uinput.h定义)(例如,由于某种原因,Android不定义它),那么您可以使用UI_GET_SYSNAME 。 它会给你一个在/sys/devices/virtual/input创建的设备的名称。 一旦你知道了sysfs中的设备,你可以通过阅读这个SO问题来找出在/dev/input创建的设备。

在调用UI_DEV_CREATE像这样使用它(省略错误/完整性检查):

ioctl(fd, UI_DEV_CREATE);

char sysfs_device_name[16];
ioctl(fd, UI_GET_SYSNAME(sizeof(sysfs_device_name)), sysfs_device_name);
printf("/sys/devices/virtual/input/%s\n", sysfs_device_name);

如果它不可用,您可以尝试查找/proc/bus/input/devices的sysfs设备,该/proc/bus/input/devices应该包含如下条目:

I: Bus=0006 Vendor=0001 Product=0001 Version=0001
N: Name="your-uinput-device-name"
P: Phys=
S: Sysfs=/devices/virtual/input/input12
U: Uniq=
H: Handlers=sysrq kbd mouse0 event11 
B: PROP=0
B: EV=7
B: KEY=70000 0 0 0 0 0 7ffff ffffffff fffffffe
B: REL=143

..有点混乱。 但正如您所看到的,它还将为您提供在/dev/input创建的设备的快捷方式。


Yes, you can use UI_GET_SYSNAME (defined in /usr/include/linux/uinput.h) if it's available on your platform (Android, for instance, does not define it for some reason). It will give you a name for the device created in /sys/devices/virtual/input. Once you know the device in sysfs, you can figure out the device(s) created in /dev/input by reading this SO question.

Use it after calling UI_DEV_CREATE like so (omitting error/sanity checking):

ioctl(fd, UI_DEV_CREATE);

char sysfs_device_name[16];
ioctl(fd, UI_GET_SYSNAME(sizeof(sysfs_device_name)), sysfs_device_name);
printf("/sys/devices/virtual/input/%s\n", sysfs_device_name);

If it is not available, you can try looking up the sysfs device in /proc/bus/input/devices which should contain an entry like:

I: Bus=0006 Vendor=0001 Product=0001 Version=0001
N: Name="your-uinput-device-name"
P: Phys=
S: Sysfs=/devices/virtual/input/input12
U: Uniq=
H: Handlers=sysrq kbd mouse0 event11 
B: PROP=0
B: EV=7
B: KEY=70000 0 0 0 0 0 7ffff ffffffff fffffffe
B: REL=143

..which is a bit messier. But as you can see it'll also give you a shortcut to the device created in /dev/input.

相关问答

更多
  • 是。 每次打开uinput设备节点时,都会获得新虚拟输入设备的文件描述符。 这将持续到您关闭文件描述符。 API是低级的,基本上是内核中相同API的变体。 您可以使用ioctl()调用来配置设备(即多少轴?多少个按钮?等等)然后将()原始事件结构写入描述符。 你有没有尝试过那里的教程? 这是谷歌的首次亮相: http : //thiemonge.org/getting-started-with-uinput Yes. Every time you open the uinput device node, y ...
  • uinput驱动程序模块是否加载? 尝试: $ lsmod | grep uinput 这可能不会显示任何内容,这意味着驱动程序未加载。 尝试加载它: $ modprobe uinput 然后尝试你的Python代码。 如果你没有以root权限运行你的代码,你可能会因为/dev/uinput设备文件上的访问PermissionError而获得一个PermissionError 。 Is the uinput driver module loaded? Try: $ lsmod | grep uinput ...
  • Okey,在设置XY位置的绝对值之前,我通过介绍下面的代码来解决这个问题。 memset(&ev, 0, sizeof(struct input_event)); gettimeofday(&ev.time,0); ev.type = EV_KEY; ev.code = BTN_LEFT; ev.value = 1; if(write(fd, &ev, sizeof(struct input_event)) < 0) die("error: write"); 所以,流程将是。 1) ...
  • 好的,所以我去了,并提出了以下解决方案; 它并不是非常漂亮,但mount和df应该可用于大多数unix版本,并且这应该通过处理卷返回正确的设备标识符,直到它不再进一步。 在大多数情况下,它应该只需要一次或两次迭代。 function get_device() { fs=$(df -k "$1" | tail -1) # Determine the device for the file-system device= mnt=$(echo "$fs" | awk '{ pri ...
  • 是的,如果您的平台上有可用的UI_GET_SYSNAME (在/usr/include/linux/uinput.h定义)(例如,由于某种原因,Android不定义它),那么您可以使用UI_GET_SYSNAME 。 它会给你一个在/sys/devices/virtual/input创建的设备的名称。 一旦你知道了sysfs中的设备,你可以通过阅读这个SO问题来找出在/dev/input创建的设备。 在调用UI_DEV_CREATE像这样使用它(省略错误/完整性检查): ioctl(fd, UI_DEV_C ...
  • 如你所说,Gimp希望你在你的驱动程序中提供ABS_X和ABS_Y以及ABS_PRESSURE - 这并不奇怪,因为你使用虚拟设备作为输入,所以从一个选择ABS_X和ABS_Y坐标没有多大意义另一个设备和ABS_PRESSURE(虽然在这种情况下它们总是相同的)。 也许您可以只读取鼠标的当前坐标并将其复制为您自己的设备坐标。 作为一个例子,项目GfxTablet做了类似你正在尝试的事情,他们有一个Android应用程序用于带有笔的平板电脑,并使用uinput创建虚拟设备,就像在Linux上使用压力感应笔一样 ...
  • 这就是getattr的用途...... key = "H" my_key = getattr(uinput,"KEY_"+key) device.emit(my_key, 1) # Press. device.emit(my_key, 0) # Release. 我觉得应该有用 this is what getattr is for ... key = "H" my_key = getattr(uinput,"KEY_"+key) device.emit(my_key, 1) # Press. devic ...
  • 您似乎正在使用Python包keyboard ,其描述如下: 在Windows和Linux上挂钩并模拟键盘事件 如果您想在MacOS上使用键盘事件,则需要找到一个可以执行此操作的程序包。 You appear to be using the Python package keyboard, whose description is: Hook and simulate keyboard events on Windows and Linux If you want to do work with keybo ...
  • 您还应该在实际事件之后编写同步事件。 在你的作家方代码中: struct input_event ev = {0}; ev.type = EV_ABS; ev.code = ABS_X; ev.value = 42; usleep(1500); memset(&ev, 0, sizeof(ev)); ev.type = EV_SYN; ev.code = 0; ev.value = 0; ret = write(fd, &ev, sizeof(ev)); getchar(); You should ...
  • evtest或evemu是否不足以满足您的测试需求? 它们在大多数Linux发行版中都是标准存储库,对于临时测试来说当然足够了。 我在这里发布了一些示例代码,作为如何从Linux中的特定输入事件设备读取条形码的答案。 它具有超时支持,并且抓取输入设备(在输入事件设备文件描述符上使用ioctl(fd, EVIOCGRAB, 1) ),以便不传播事件,并且尝试获取设备的其他进程因EBUSY失败。 修改它以便以您觉得舒服的方式检查设备提供的事件结构应该不会太困难。 Are evtest or evemu insu ...

相关文章

更多

最新问答

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