2

如何在多个字段的组合上创建 Endeca 查询 [就像 sql 查询中的 where 子句一样]。假设我们有三个索引字段是 -

  1. empId
  2. 员工姓名
  3. 雇员性别

现在,我需要一个查询,例如“empName like 's%' AND empGender=male”

谢谢。

4

2 回答 2

4

Firstly,

Checkout Record Filters in the Advanced Development Guide.

If you are trying to use a Record Filter on a property, you will need to enable it explicitly in Developer Studio for that property, while your Dimensions will automatically have the ability to apply a Record Filter. This will help when you have explicit values to filter on, for example empGender.

Your Record Filter can then look as follow:

Nr=AND(empGender:male)

You can further use the Ntk parameter to specify fields to search on so assuming your empName field is enabled for wildcard searching (configure this in Developer Studio) searching this field will look as follow:

Ntk=empName&Ntt=s*

So assuming your properties have been configured correctly, your example above will probably end up looking as follow:

Nr=AND(empGender:male)&Ntk=empName&Ntt=s*

To take this one step further, you can specify Search Filters (ie. Ntk + Ntt parameters) together. I haven't tried this for wildcards so you'll need to confirm that yourself but to combine Search Filters you delimit them with |

Ntk=empName|empId&Ntt=s*|1234*

I suggest you manually build up queries in the Reference Application to confirm you get your expected results and then start to code this up in your application.

于 2013-11-28T05:21:00.810 回答
0

radimbe,这个用例的记录过滤器的问题是它们需要精确。这意味着您不会得到拼写更正、词库扩展、不区分大小写或词干提取。用户不太可能输入这样的精确信息。

Saraubh,您可以执行布尔搜索来执行 OR 文本搜索查询。您还可以使用Endeca 查询语言来指定一组复杂的布尔逻辑,该逻辑超越了布尔搜索,并且将包含拼写更正、词干提取等。

但总的来说,我认为对于这样的应用程序,您应该远离同时搜索特定的单个字段,并利用维度的分面功能来指导用户。此外,按重要性顺序同时搜索多个字段的搜索框确实是为此类应用程序简化用户界面的方法。

于 2013-12-06T17:27:39.697 回答