1 Reply Latest reply: Dec 21, 2006 11:51 AM by 488514 RSS

    More problems with java query API - getExcerpt fails

    488514
      If I write my code this way, everything works:

      mySearchRequest.setQuery(new oracle.ultrasearch.query.Contains(searchString, metadata));

      But if I do this, Document.getExcerpt() starts returning null for the same search hits:

      mySearchRequest.setQuery(
      new oracle.ultrasearch.query.And(
      new oracle.ultrasearch.query.Contains(searchString, metadata),
      new oracle.ultrasearch.query.From(metadata.getGroup(groupToSearch))
      )
      );

      Does anybody know how to make this work? I need to limit my searches by groups so that I don't have to create a new UltraSearch Instance for every single web site that has to be crawled (I have several).

      Troy
        • 1. Re: More problems with java query API - getExcerpt fails
          488514
          Well, I finally discovered he solution on my own, by reverse-engineering Oracle's own search.jsp (which does not use Oracle's custom tag library, btw) (probably because same doesn't really work, or at least it doesn't what's in the documentation doesn't work) (which isn't surprising).

          You have to do the "From" part of the query as an "attribute filter".

          oracle.ultrasearch.query.Query searchQuery=
          new oracle.ultrasearch.query.Contains(searchString, metadata);
          oracle.ultrasearch.query.Query attrQuery=
          new oracle.ultrasearch.query.From(metadata.getGroup(groupToSearch));
          oracle.ultrasearch.query.Request searchRequest=new oracle.ultrasearch.query.Request();
          searchRequest.setQuery(searchQuery);
          searchRequest.setFilter (attrQuery);

          Maybe that will do somebody some good somewhere...

          Troy