首页 \ 问答 \ 提炼Solr搜索,获得精确匹配?(Refining Solr searches, getting exact matches?)

提炼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
更新时间:2023-09-14 13:09

最满意答案

如何获得此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.

相关问答

更多