提炼Solr搜索,获得精确匹配?(Refining Solr searches, getting exact matches?)
下午的队,
没错,我正在为使用Solr的网站构建一个相当复杂的(对我来说)搜索系统,尽管这个问题很简单,我认为...
我有两个搜索条件,位置和类型。 我想要返回完全匹配的结果以输入(字母转换为字母,无例外)以及类似位置。
我目前的搜索查询如下
../select/?q=location:N1 type:blue&rows = 100&fl = *,score&debugQuery = true
首先返回匹配N1的所有类型的蓝色,但是然后返回任何匹配N1的类型,这与我之后的相反。 这两个字段在Solr模式中都设置为textgen。
任何指针?
干杯帮派
Afternoon chaps,
Right, I'm constructing a fairly complex (to me anyway) search system for a website using Solr, although this question is quite simple I think...
I have two search criteria, location and type. I want to return results that are exact matches to type (letter to letter, no exceptions), and like location.
My current search query is as follows
../select/?q=location:N1 type:blue&rows=100&fl=*,score&debugQuery=true
This firstly returns all the type blue's that match N1, but then returns any type that matches N1, which is opposite to what I'm after. Both fields are set as textgen in the Solr schema.
Any pointers?
Cheers gang
原文:https://stackoverflow.com/questions/2745930
最满意答案
如何获得此GUID值?
GUID是作为COM接口定义的一部分创建的; 因为你试图打电话给别人的对象 - 你需要使用他们的GUID。 您可以在MMDevice docs指向的mmdeviceapi.h中找到它。
头文件Mmdeviceapi.h定义了MMDevice API中的接口。
MIDL_INTERFACE("A95664D2-9614-4F35-A746-DE8DB63617E6") IMMDeviceEnumerator : public IUnknown
执行此操作的常规方法是添加对COM dll的引用或运行tlbimp.exe,它将为您生成具有所有魔法粘性的COM类包装器。
但是,如果COM类型库不可用 - 那么您基本上必须通过IDL文件自己完成。
就像p / invoke签名一样,这可能会非常痛苦 - 如果可以 , 最好使用现有签名。
对于COM互操作的更大问题,它基本上需要学习一点COM并熟悉C#。 一般文档都在那里 ,但通常如果你只是尝试使用一个众所周知的COM组件,你最好使用一个库,如果可以的话。
How was this GUID value obtained?
The GUID is created as part of the COM interface definition; since you're trying to call someone else's object - you need to use their GUID. You can find it in the mmdeviceapi.h the MMDevice docs point to.
Header file Mmdeviceapi.h defines the interfaces in the MMDevice API.
MIDL_INTERFACE("A95664D2-9614-4F35-A746-DE8DB63617E6") IMMDeviceEnumerator : public IUnknown
The normal way to do this is to add a reference to the COM dll or run tlbimp.exe which will generate a COM Class Wrapper for you with all the magic goo.
If a COM type library isn't available, though - then you basically have to do it yourself by going through the IDL file.
Like p/invoke signatures, this can get pretty painful - so best to use an existing one if you can.
For the larger questions of COM interop, it basically requires learning a little bit of COM and being familiar with C#. The general docs are out there, but usually if you're just trying to use a well known COM component you're best off using a library if you can.
相关问答
更多-
值得说明的是,您不需要创建类/构造函数,只需要为每个条目创建一个新对象 for ( var i = 0; i < input.length; ++i ) { var ds = new Object(); // var ds = {} is equivalent ds.ID = input[i].ID; ds.Name = input[i].Name; ds.City = input[i].City; ds.Comments = ...
-
如何正确声明对象中的Javascript对象数组(How to properly declare a Javascript array of objects in an object)[2023-10-02]
以下对我有用: function Base() { this.n = 5; this.obj = []; for (var i = 0; i < this.n; i++) { this.obj.push(new Test()); } } Test : var Test = function () {}; 看起来真正的问题是它从未创建过this.obj因为n未定义。 如果要声明数组之前的操作方式,请尝试使用new Array(this.n) 。 编辑 新的A ... -
您在构造函数中声明了AxeA和P变量的新本地实例,而不是将值分配给父属性。 而不是这个: public class Sample { public Axe[] AxeA; public Sample(int nAxe){ Axe[] AxeA = new Axe[nAxe]; // declaring a new local variable named AxeA which hides the parent scope variable } } 你应该做这个: p ...
-
如何获得此GUID值? GUID是作为COM接口定义的一部分创建的; 因为你试图打电话给别人的对象 - 你需要使用他们的GUID。 您可以在MMDevice docs指向的mmdeviceapi.h中找到它。 头文件Mmdeviceapi.h定义了MMDevice API中的接口。 MIDL_INTERFACE("A95664D2-9614-4F35-A746-DE8DB63617E6") IMMDeviceEnumerator : public IUnknown 执行此操作的常规方法是添加对C ...
-
在基本的GUI编程中,在哪里声明对象和方法?(Where does one declare objects and methods in basic GUI programming? [closed])[2024-01-03]
实际上,无论应用程序的类型如何,我们通常都不会main声明多个变量。 例如,那些“整个应用程序可访问的参数”可以是单例类的成员。 一般来说,你看看两个类需要共享一个变量的原因。 当你知道他们为什么合作时,回答这个问题,两个班级如何合作往往更容易。 例如,如果B类是A的助手类,那么每个B实例仅仅用于帮助单个A,并且B的生命期因此完全由它的A对象决定,那么A应该只拥有B,并且可以访问B的所有成员变量(通过B的成员函数,当然不是直接的。C ++类默认为private:是有很好的理由的:) Actually, we ... -
什么时候申报对象?(When to declare objects?)[2021-12-16]
让我们测试如何编译这些类。 public class Test1 { private Scanner in; public Test1() { in = new Scanner(System.in); } } 和 public class Test2 { private Scanner in = new Scanner(System.in); public Test2() { } } 如果我们使用javap -c Test1我们会看到 ... -
如何在另一个对象的构造函数中声明和创建对象?(how to declare and make objects inside another object's constructor?)[2023-07-30]
你的语法错了。 您正在寻找所谓的构造函数初始化列表 。 尝试(假设你已经为Grass构造函数的签名正确): World::World() : g1(200, 200), g2(300, 200) { // Nothing } Your syntax is wrong. You're looking for what's known as a constructor initialization list. Try (assuming you've got the signat ... -
使用您的界面而不是对象 LinkedList
list 你可以添加任何类实现MyInterface Use your interface instead of Object LinkedList list with that you can add whichever class implements MyInterface -
您尝试为对象提供属性,该属性将是单个对象: dictionaries.english_to_french = {english:"hello",french:"bonjour"} ; 你不需要额外的{ } 。 你可以立刻宣布整件事: var dictionaries = { english_to_french: { english: "hello", french: "bonjour" } }; 我建议你的词典更好的格式可能是: var dictionaries = { engl ...
-
你可以像你说的那样点击对象列表: List