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
最满意答案
是的,如果您的平台上有可用的
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
.
相关问答
更多-
多个输入设备(Multiple uinput devices)[2023-04-08]
是。 每次打开uinput设备节点时,都会获得新虚拟输入设备的文件描述符。 这将持续到您关闭文件描述符。 API是低级的,基本上是内核中相同API的变体。 您可以使用ioctl()调用来配置设备(即多少轴?多少个按钮?等等)然后将()原始事件结构写入描述符。 你有没有尝试过那里的教程? 这是谷歌的首次亮相: http : //thiemonge.org/getting-started-with-uinput Yes. Every time you open the uinput device node, y ... -
OSError:[Errno 19]无法打开输入设备:没有这样的设备(OSError: [Errno 19] Failed to open the uinput device: No such device)[2023-08-05]
uinput驱动程序模块是否加载? 尝试: $ lsmod | grep uinput 这可能不会显示任何内容,这意味着驱动程序未加载。 尝试加载它: $ modprobe uinput 然后尝试你的Python代码。 如果你没有以root权限运行你的代码,你可能会因为/dev/uinput设备文件上的访问PermissionError而获得一个PermissionError 。 Is the uinput driver module loaded? Try: $ lsmod | grep uinput ... -
鼠标指针在uinput子系统中移动后无法模拟Click事件(Unable to Emulate Click event after mouse pointer moved in uinput subsystem)[2024-04-24]
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 ...
-
创建一个类似Wacom的Linux输入设备,用于触摸屏和笔(Create a Wacom-like Linux uinput device for work with touchscreen and pen)[2022-02-15]
如你所说,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 ...
-
IOError:[Errno 1]不允许操作:'/ dev / uinput'(IOError: [Errno 1] Operation not permitted: '/dev/uinput')[2023-08-04]
您似乎正在使用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 ...
-
用C抓住一个设备(Grab a device in C)[2022-04-06]
evtest或evemu是否不足以满足您的测试需求? 它们在大多数Linux发行版中都是标准存储库,对于临时测试来说当然足够了。 我在这里发布了一些示例代码,作为如何从Linux中的特定输入事件设备读取条形码的答案。 它具有超时支持,并且抓取输入设备(在输入事件设备文件描述符上使用ioctl(fd, EVIOCGRAB, 1) ),以便不传播事件,并且尝试获取设备的其他进程因EBUSY失败。 修改它以便以您觉得舒服的方式检查设备提供的事件结构应该不会太困难。 Are evtest or evemu insu ...