【问题标题】:GSA use connector for databases do not have metadata?GSA 使用数据库连接器没有元数据?
【发布时间】:2015-05-23 07:46:17
【问题描述】:

我们正在开展一个 GSA 项目。我们正在使用 GSA 7.2 版和连接器数据库适配器 3.2.4。 那个 SQL 为

SELECT EMPLOYEE_ID,
  FIRST_NAME,
  LAST_NAME,
  EMAIL,
  PHONE_NUMBER,
  HIRE_DATE,
  JOB_ID,
  SALARY,
  COMMISSION_PCT,
  MANAGER_ID,
  DEPARTMENT_ID
FROM HR.EMPLOYEES ;

如何编写“服务结果样式表”以显示来自 SQL 的所有元数据。

【问题讨论】:

    标签: google-search-appliance


    【解决方案1】:

    您必须按如下方式自定义样式表:

    `<?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
    <html>
    <head>
    <xsl:for-each select="pland_connector"> <!-- name of connector -->
      <!-- now for every single field from the database you want to be able to filter upon or show in your result, add a meta-field -->
      <title><xsl:value-of select="LAST_NAME"/></title> <!-- don't forget the title -> that is the default title in the GSA result -->
      <meta name="EMPLOYEE_ID"><xsl:attribute name="content"><xsl:value-of select="EMPLOYEE_ID"/></xsl:attribute></meta> 
      <!-- mind the capital sensitivity of XML, dependend on the notation in you db view or table the value-of should be in capitals or not -->
      <meta name="LAST_NAME"><xsl:attribute name="content"><xsl:value-of select="LAST_NAME"/></xsl:attribute></meta>
      <meta name="FIRST_NAME"><xsl:attribute name="content"><xsl:value-of select="FIRST_NAME"/></xsl:attribute></meta>
      <meta name="EMAIL"><xsl:attribute name="content"><xsl:value-of select="EMAIL"/></xsl:attribute></meta>
      <meta name="PHONE_NUMBER"><xsl:attribute name="content"><xsl:value-of select="PHONE_NUMBER"/></xsl:attribute></meta>
      <!-- Etc..... -->
    
    </xsl:for-each>
    <!-- You can add static metadata to -->
    <meta name="test" content="Person"/>
    </head>
    <body>
    <!-- Just see what data you want in the content-field -->
    <xsl:for-each select="pland_connector"> <!-- Name of database -->
      <h1><xsl:value-of select="NAME"/></h1></br>
    </xsl:for-each>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>`
    

    我想你会完成的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-22
      • 2014-08-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多