7 Replies Latest reply on Dec 19, 2012 9:29 AM by Roger Ford-Oracle

    A picture of user in SES search

      Hi for all,

      I want to show a picture of user inside the search of SES. So, I changed the 'Search Result List', but this dosen't works. Does anyone have any tips on how I can do this?
         <xsl:if test="img_user[.!='']">
            <fo:instream-foreign-object content-type="image/jpg">
               <xsl:value-of select=".//IMG_USER"/>
      Kind regards
        • 1. Re: A picture of user in SES search
          Roger Ford-Oracle
          What's in your img_user attribute? Is it a URL? Or binary image data?

          What does this look like in the generated HTML shown in the result list?
          • 2. Re: A picture of user in SES search
            Hi Roger,

            Thank you for your feedback. I have a view that returns an image in 'Base64Encode'. This view is invoked by the SES crawler and returns some information as
            KEY, URL, Title, IMG_USER and so on. I would like to make the search for a user name and return some information and
            the image of the user as well. However, I need the image to be rendered in SES search result (at runtime).

            Kind regards,
            • 3. Re: A picture of user in SES search
              Roger Ford-Oracle
              I'm not familiar with the "instream-foreign-object" command. Would you normally expect this to accept Base64 text and output an image? Would it surround it with the necessary HTML <img> tags?

              To debug this: First, remove ALL the xslt code from the edit box. When it's empty, run your query. You should see the raw XML output on the screen. Is what you're seeing here in the IMG_USER tag what you're expecting to get as the input to fo:instream-foreign-object? If the answer is "yes", then replace your xslt code, run the query, and view the source of the page (CTRL-U in Firefox, F12 -> View -> Source in IE) and see what it's writing into the HTML output stream for the page.
              1 person found this helpful
              • 4. Re: A picture of user in SES search
                Thanks for your considerations Roger. I did what you said, I removed all xslt code and found that output IMG_USER being cut. Let me explain: In the database I have a view that returns the data to the crawler in SES. When the view is executed inside the database, IMG_USER field returns a clob type with all characters which compose the image. However, in the SES I'm running this view in crawler with 'Select * from VW_USERS'. If I'm not mistaken there is a limitation in SQL return 4K. In this case, the string field IMG_USER coming from the DB was being cut to 4K.

                Do you agree with that? How do you think I could solve this situation?

                Kind regards
                • 5. Re: A picture of user in SES search
                  Roger Ford-Oracle
                  Ah yes - hadn't thought of that. An attribute is limited to 4K in size. Don't think there's any way around that.

                  I think you're going to have to go about this some other way - fetching the image directly from the database using some other technology, and just sending the URL to the SES web page via an attribute. You might be able to use the XML DB listener in the database, for example, to fetch the image. Or if the database is firewalled such that you can't access the XML DB listener, then you could add a JSP file into SES (you'll need to look up skin bundles to figure out how to do that), and the JSP could access the database directly.

                  In case it helps, here's a JSP file I've used successfully with SES before to fetch a document from the database based on an ID value passed in on the URL:
                  <%@ page import="java.sql.*, java.util.*, java.io.*, java.net.*, oracle.jdbc.*, oracle.jdbc.pool.*, oracle.jsp.dbutil.*" %>
                  <%@ page contentType="text/html;charset=UTF-8" %>
                  <jsp:useBean id="name" class="oracle.jsp.jml.JmlString" scope ="request" >
                  <jsp:setProperty name="name" property="value" param="id" />
                  Connection conn = null;
                  PreparedStatement fetchStmt0=null;
                  PreparedStatement fetchStmt1=null;
                  ResultSet rset0 = null;
                  ResultSet rset1 = null;
                  String mesg = "";
                  String idstr = request.getParameter("id");
                  String subj = null;
                  OracleDataSource ods = new OracleDataSource();
                  // Set the user name, password, driver type and network protocol
                  ods.setUser         ("scott");
                  ods.setPassword     ("tiger");
                  ods.setDriverType   ("thin");
                  ods.setServerName   ("localhost");
                  ods.setPortNumber   (1521);
                  ods.setDatabaseName ("orcl");
                  Bug Details
                  <H2><font color=red>Database - Web View</font></H2>
                  try { 
                    javax.naming.InitialContext ic=new javax.naming.InitialContext();
                    javax.sql.DataSource ds= (javax.sql.DataSource)ic.lookup("jdbc/OracleDS");
                    conn = ods.getConnection();
                    fetchStmt0=conn.prepareStatement("select key,title,content from my_table where key=?");
                    rset0 =fetchStmt0.executeQuery();
                    String key = "";
                    String title = "";
                    String content = "";
                    if ( rset0.next()) {
                  <table border=1>
                    <font size=+2><b>
                    <tr><td> <font size=+2><b> Doc ID </b> </font> </td><td> <font size=+2><b> <%= key %> </b></font> </td></tr>
                    <tr><td> <font size=+2><b> Title    </b> </font> </td><td> <font size=+2><b> <%= title %> </b></font> </td></tr>
                    <tr><td> <font size=+2><b> Content    </b> </font> </td><td> <font size=+2><b> <%= content %> </b></ont> </td></tr>
                  catch (Exception e) {
                    mesg = e.toString();
                  finally {  
                        if (rset0 != null) rset0.close(); 
                        if (fetchStmt0 != null) fetchStmt0.close();
                        if (conn != null) conn.close();
                   <%= mesg %>
                  1 person found this helpful
                  • 6. Re: A picture of user in SES search
                    Again thank you Roger. I found a doc written by you in 2007 'Building Custom Crawlers for Oracle Secure Enterprise Search'. I'll try to implement a crawler in Java following your example. I'm using version of SES in this case, do you think I will have problems because the document make reference to SES 10.1.8?

                    Kind regards
                    • 7. Re: A picture of user in SES search
                      Roger Ford-Oracle
                      The 10.1.8 crawler code should work fine with

                      I'm not entirely sure writing a new crawler is going to solve your problem though - you'll still be limited to 4K for an attribute.

                      By the way, I should mention that I'm not part of the SES group these days, so I'm helping out here on a strictly amateur basis.