Searching for content within a specified directory

I am trying to do a simple content search on a specified directory, but I do not get the results I expect.
I have looked at the examples and based my code upon them.
If anyone can spot what I am missing or have forgotten I would be very grateful.
Thanks
Chris

Here is the offending code :import oracle.ifs.beans.LibrarySession;
import oracle.ifs.beans.LibraryService;
import oracle.ifs.adk.filesystem.*;
import oracle.ifs.beans.Search;
import oracle.ifs.search.AttributeQualification;
import oracle.ifs.search.AttributeSearchSpecification;
import oracle.ifs.search.ContextQualification;
import oracle.ifs.search.ContextSearchSpecification;
import oracle.ifs.search.FolderRestrictQualification;
import oracle.ifs.search.JoinQualification;
import oracle.ifs.search.SearchClassSpecification;
import oracle.ifs.search.SearchClause;
import oracle.ifs.search.SearchQualification;
import oracle.ifs.search.SearchSpecification;
import oracle.ifs.search.SearchSortSpecification;
// Import objects for working with search results
import oracle.ifs.beans.LibraryObject;
import oracle.ifs.beans.PublicObject;
import oracle.ifs.beans.Folder;
import oracle.ifs.beans.Document;
import oracle.ifs.beans.ContentObject;
import oracle.ifs.beans.SearchResultObject;
// Import object for exception handling
import oracle.ifs.common.IfsException;
import oracle.ifs.common.AttributeValue;
import java.util.Vector;
public class contentSearch
LibrarySession ls;
String strSearch;
public contentSearch()
public void setSession( LibrarySession libsession )
ls = libsession;
public LibrarySession getSession()
return ls;
public void setSearchString(String str)
strSearch = str;
public PublicObject[] SearchSimple()
Vector vecOutput = new Vector(50,5); PublicObject[] resultsArray = null;
try
ContextQualification cq = new ContextQualification();
cq.setQuery(strSearch);
String ContextClauseName = "CQ";
cq.setName(ContextClauseName);
SearchSortSpecification sortSpec = new SearchSortSpecification();
sortSpec.add(Document.CLASS_NAME, ContextQualification.ORDER_PREFIX+"."+ContextClauseName, true);
JoinQualification jq = new JoinQualification();
jq.setLeftAttribute(Document.CLASS_NAME, Document.CONTENTOBJECT_ATTRIBUTE);
jq.setRightAttribute(ContentObject.CLASS_NAME, null);
// Add Folder Restriction for the search
IfsFileSystem fsAPI = new IfsFileSystem( ls );
PublicObject po = fsAPI.findPublicObjectByPath("public_demo");
FolderRestrictQualification frq = new FolderRestrictQualification();
frq.setStartFolder( (Folder) po);
frq.setSearchClassname(PublicObject.CLASS_NAME);
// END of FolderRestrictionQualification
SearchClause sc = new SearchClause( cq, jq, SearchClause.AND );
ContextSearchSpecification cp = new ContextSearchSpecification();
cp.setContextClassname("CONTENTOBJECT");
cp.setSearchClassSpecification(new SearchClassSpecification(new String[] {"DOCUMENT", "CONTENTOBJECT"}));
cp.setSearchQualification(sc);
cp.setSearchSortSpecification(sortSpec);
// Session connection
LibrarySession session;
LibraryService serv;
// Connect to Oracle iFS
serv = new LibraryService();
session = serv.connect("system", "manager", "IfsDefault");
Search s = new Search(session, cp);
try
LibraryObject lo;
// Open the search
s.open();
while (true)
// Returns the next result row into Library Object
lo = s.next().getLibraryObject();
// Add LibraryObject to output vector to return
vecOutput.addElement( lo );
if (lo == null)
throw new RuntimeException ("Retrieving search results : LibraryObject is null");
else
// Print results
System.out.println(lo.getName());
} // End Of While Loop
} // End Of try block for search open
catch (IfsException e)
/* Throw an error, unless the exception is
* 22000 'End of Data' which is always thrown
* when s.next() reaches the end of the cursor.
if (e.getErrorCode() != 22000 )
// Something bad happened
e.setVerboseMessage(true);
throw new RuntimeException("Error happened in returning result set:"+e.getMessage());
} // End of catch block for search open
finally
// Check if the size of ResultSet Vector Is more than zero
if ( vecOutput.size() > 0)
resultsArray = new Pub licObject[vecOutput.size()];
for (int i=0; i < vecOutput.size(); i++)
// Copy the result set library object to Public Object Array
resultsArray[i] = (PublicObject) vecOutput.elementAt(i);
} // End IF
// Close the search
s.close();
} // End of Finally block for search open
catch (IfsException i)
System.out.println(" " + i.getMessage());
return resultsArray; // Return the results
null

Similar Messages

  • Search for content within a PDF

    Is it possible to search for content within a PDF across a mapped drive?

    Yes. Use Edit>Advanced search. Choose All PDF Documents in and choose the mapped drive.
    They have to be searchable PDF's of course...

  • Searching for documens within dates

    I thought that my issue was a trivial one but I have not a way to resolve it.
    I have three Doc libraries containing mainly PDFs.
    I need to be able to search for files within two dates (based either on Created, Modified or a Custom Date that I defined in each library).
    Thanks

    This works for Created:
      Created>12/11/2013  Created<12/15/2013
    as does this  (both are managed properties for the same field)
      DocCreatedTm>12/11/2013 AND DocCreatedTm<12/15/2013
    This works for Modified:
      Write>12/11/2013 AND Write<12/15/2013
    You can use LastModifiedTime, Write or FileWrite as the property name.
    You can find a list of managed properties ("Manage Search Schema") in the Search admin pages of Central Admin or Office 365.
    Note that AND, OR and NOT must be in upper case.
    Mike Smith TechTrainingNotes.blogspot.com
    my SP customization book

  • Searching for content in stored webpages?

    I am a student and Oracle Text is new to me. I am using isqlPlus with Oracle10g
    I am trying to search the content of external websites I upload using a procedure. The files are uploaded as BLOBs. I know UltraSearch is out there, but I´m trying to make an easy example using only SQL syntax. So far, I am able to load the html documents into a directory, but the search results are always 0. I don´t know what I am missing (sorry for the ignorance)! Can anyone give me some tips?
    I am not a DBA. This are the rights I have:
    CONNECT
    CREATE SESSION
    CREATE ANY DIRECTORY
    CTXAPP
    RESOURCE
    CREATE CLUSTER
    CREATE INDEXTYPE
    CREATE OPERATOR
    CREATE PROCEDURE
    CREATE SEQUENCE
    CREATE TABLE
    CREATE TRIGGER
    CREATE TYPE
    UNLIMITED TABLESPACE
    --First I create a table
    DROP TABLE t03_sorbaugh.CONTENT_INVENTORY;
    CREATE TABLE t03_sorbaugh.CONTENT_INVENTORY (
    CONTENT_INVENTORY_ID NUMBER NOT NULL,
    FILE_NAME VARCHAR2(1024),
    KEYWORDS VARCHAR2(2048),
    URL SYS.HTTPURITYPE,
    TEXT BLOB DEFAULT empty_blob(),
    TEXT_LOADED CHAR(1) DEFAULT 'N' NOT NULL,
    CONSTRAINT UNQ_CONTENT_INVENTORY
    UNIQUE(CONTENT_INVENTORY_ID) USING INDEX
    TABLESPACE USERS
    --Then I load an external Website
    INSERT INTO t03_sorbaugh.CONTENT_INVENTORY
    (CONTENT_INVENTORY_ID, URL, KEYWORDS)
    VALUES ('1', sys.httpuritype.createuri('http://en.wikipedia.org/wiki/Art'), '');
    COMMIT;
    --The Procedure looks like this (sorry for not keeping it short)
    CREATE OR REPLACE PROCEDURE loadLOBFromBFILE IS
    Dest_loc BLOB;
    Src_loc BFILE := BFILENAME('DIR_TESTCASE', '');
    Amount INTEGER := 0;
    cursor ContentInv_cursor is
    --create a recordset of the file names
    --that we need to load from the filesystem into the
    --Oracle database.
    SELECT
    CONTENT_INVENTORY_ID,
    FILE_NAME
    FROM t03_sorbaugh.CONTENT_INVENTORY
    WHERE FILE_NAME IS NOT NULL;
    varContentInv_id CONTENT_INVENTORY.CONTENT_INVENTORY_ID%TYPE;
    varFileName CONTENT_INVENTORY.FILE_NAME%TYPE;
    BEGIN
    open ContentInv_cursor;
    loop
    varFileName := NULL;
    varContentInv_id := NULL;
    fetch ContentInv_cursor into varContentInv_id, varFileName;
    exit when ContentInv_cursor%notfound;
    Src_loc := BFILENAME('DIR_TESTCASE', varFileName);
    IF DBMS_LOB.FILEEXISTS (Src_loc) = 1 THEN
    SELECT text INTO Dest_loc FROM CONTENT_INVENTORY
    WHERE CONTENT_INVENTORY_ID = varContentInv_id FOR UPDATE;
    /* Opening the LOB is mandatory */
    DBMS_LOB.OPEN(Src_loc, DBMS_LOB.LOB_READONLY);
    DBMS_LOB.LOADFROMFILE(Dest_loc, Src_loc, dbms_lob.getlength(Src_loc));
    /* Closing the LOB is mandatory */
    DBMS_LOB.CLOSE(Src_loc);
    /* Optional update statement */
    UPDATE t03_sorbaugh.CONTENT_INVENTORY
    SET TEXT_LOADED = 'Y'
    WHERE CONTENT_INVENTORY_ID = varContentInv_id;
    COMMIT;
    END IF;
    end loop;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR (-20001, 'Error occurred while loading LOBs.');
    close ContentInv_cursor;
    END;
    -- I upload the file to the directory 'd:\daten\oracletextpraktikum'
    set serveroutput on;
    EXECUTE loadLOBFromBFILE;
    -- PL/SQL-Prozedur erfolgreich abgeschlossen.
    -- Now the preferences and the index
    begin
    ctx_ddl.create_preference('doc_lexer', 'BASIC_LEXER');
    ctx_ddl.set_attribute('doc_lexer', 'printjoins', '_-');
    end;
    drop index idxContentMgmtURL;
    create index idxContentMgmtURL on content_inventory(url) indextype is ctxsys.context;
    -- Finally, I run an example where I search for the word "Art" ... the only Webpage uploaded to my directory contains the Art definition from Wikipedia, but still, I get no search results :(
    SET LINESIZE 5000
    SET PAGESIZE 5000
    select content_inventory_id, url
    from t03_sorbaugh.content_inventory
    where contains(url,'&WORD_TO_FIND') > 0;
    --Type "Art"
    neu 3: where contains(url,'art') > 0
    Es wurden keine Zeilen ausgewählt
    Is isqlPlus somehow limited in using Oracle Text? I can´t seem to find the Problem!

    Okay, but I'm afarid I can't help much more than that, as I'm still new at Oracle Text myself. From my limited knowledge, it all looks fine, but like you, I must be missing something.
    You might try asking the DBA if the TXTSUP_UTIL package is installed in the CTXSYS schema. If it isn't, he can download it from Metalink or I can send it via email.
    While it won't fix the problem, it does offer some insight into the index preferences and storage, etc.
    BIll Ferguson

  • How to search for file within compressed file

    I hope i can explain this correctly, I apologize in advance.
    What is the command to search for a file that may/may not exist within another compressed file?
    Situation is that I have a cron job that compresses the files in a folder on a scheduled date. I now need to search for a file that may exists in one of the several compressed files, which was a result of the cron job.
    Thanks in advance

    There's an open source utility called zgrep. You can probably get it from http://www.sunfreeware.com/ .
    HTH,
    Roger S.

  • Searching for a file in a  directory

    Hai,
    i am ooking for a code that searches a file( file name's first part is given for example results) in a directory. so search code is going to search a filename like results.csv in the directory.
    any idea?

    Have a look at the [File API|http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html]

  • How do I search for content in my bookmarks?

    Hello,
    is there a way to search only my bookmarks for content?
    Essentially turn my bookmark folder into a personalized google?
    Thanks

    Click the Bookmarks icon left side of the Safari window then select a Bookmark folder.
    You should see a search field with a magnifying glass icon top right.

  • Searching for content in text insets

    In a FrameMaker book, is there a way to search all the text insets in a book without opening each individual inset?
    I'm working on a project that has more than 30 text insets. I'd like to search for certain terms without having to open each inset. I'm using FrameMaker 11.

    Not really, as FM won't search the inset content directly. You could try creating an auxiliary book that contains just the inset files and use the Find function on that book. You can also add this book to your main book and mark it with Exclude so it doesn't get output, but still provides access to everything from the main book file.

  • Will TREX/KM search for content on PDF files in Searchable image formats?

    Good Day,
    We are implementing KM/Trex for an SAP E-sourcing installation and I'm wondering if TREX is able to search PDF contents in the Searchable image format?
    Essentially, we scan a document which creates an image and then run Abobe Acrobats OCR on the document to create searchable text.
    Thanks in Advance,
    Kyle

    Hi Kyle,
    TREX is not able to index a scanned document even this is pdf.
    BUT if afterwards a OCR is running and this OCR text will be stored as hidden text in the pdf than TREX is able to search in this pdf.
    Best regards
    Frank

  • Search for keyword within musical genre

    Trying to help my wife find a children's song on a particular topic for her kindergarten class. How does one conduct a search for a keyword WITHIN a particular genre? For example, how do I search for "Friday" or "Weekend" within the Children's Music genre?
    Thanks...

    I didn't see an obvious way to do it in the iTunes Store, since Power Search does not have a genre choice.
    At the Amazon.com MP3 Download Store, you can go directly to Children's Music and do the search.

  • Correct way to search for character within a string

    I am trying to search for the occurrence of a "(" within a text string - unfortunately my code is reported as incorrect.
    I extract the text correctly but cannot create the search statement correctly:
    var mylistpgftext = pgf.GetText (Constants.FTI_String)   
    for (var i=0; i < mylistpgftext.length; i++)             
        var mylistitem = mylistpgftext[i].sdata              
        var mybracketpos = mylistitem.search(/(/i)    --------------error line-----------------       
        if (mybracketpos != -1)                              
          alert(mylistitem)                                  

    Hi Bob, I did not test this, but I think the problem is an unescaped character in your regular expression. Try this.
    var mybracketpos = mylistitem.search(/\(/i);
    Notice the backslash before the open parens that you are searching for.
    -Rick

  • Is there a way to globally search for content?

    As more types of video become available, my biggest bugaboo with the Apple TV is the lack of a global search for a movie or TV show title or actor. I now look on Netflix, then look on Hulu, then look at YouTube, then look in iTunes store every time I have an idea for something I wish to watch enters my head.
    Other than a jailbreak, is there some way to do this that I am not getting? Is anyone else interested in this feature? Friends running home servers like Plex always bring this up as one of the reasons to use their solution.

    Jailbreaking will not help you with that. It is a matter of what vendors are dealing wheat suppliers, they aggrements they have in place, and the content they can get, and where (geographically) they can provide it.  Other than iTunes, Apple has no control over that (and limited control even then).
    I've been using an app called CanIStream.It for a while. Not always 100% accuratre, but has helped to find some content. I think they have a corresponding website, but not sure.

  • Search for data within a database table

    Hi everyone :)
    I'm trying to make it so that the user can search for a record by id #. So, i made an input dialogue thing so the user can enter a record #. Basically, i want the data to appear in their textboxes based on the record # inputted by the user. My attempt is shown below, and when I run it, I get this:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    Here's my code:
    public JButton getSearch()
              if (search==null)
                   search = new JButton("Search Database");
                   search.addActionListener
                        new ActionListener()
                             public void actionPerformed(ActionEvent ae)
                                  try
                                       String str_rec =
                                            JOptionPane.showInputDialog(
                                                 getFrame(),"Enter Record No");
                                       int recNo = 0;
                                       try
                                            recNo =
                                                 Integer.parseInt(str_rec);
                                       catch (NumberFormatException nfe)
                                            return;
                                       String select = "SELECT studId,studFirstName,studLastName " +
                                       "FROM Students " +
                                       "WHERE studId = '" + recNo + "' ";
                                       Statement statement = getConnector().getConnection().createStatement();
                                       ResultSet result = statement.executeQuery(select);
                                       System.out.println(recNo);
                                       getView().getId().setText(str_rec);
                                       getView().getFirstName().setText(result.getString("studFirstName"));
                                       getView().getLastName().setText(result.getString("studLastName"));
                                  catch (Exception e)
                                       e.printStackTrace();
              return search;
         }I hope I explained everything properly. If you could please help me, I'd very much appreciate it.
    Thanks in advance! :)
    - spidey

    "WHERE studId = '" + recNo + "' ";Why are you putting quote marks around a number? What type of database column is studId? Probably a numeric type (not character), right? Quotes go around string/character stuff, not numeric stuff.

  • Search for text within files

    How do you search for files that contain a specific string of text?  I tried going to the folder in the finder and typing the string in the search box, but it does not seem to return correct results.   True, I do see a couple of files that contain my string, but it doesn't show all the results.  There are files that I know contain the string in the same folder, but it does not show them??
    Bob

    Spotlight should index PDF files (as well as Word and some other kinds of files) but it seems that PDFs are not created equal. I've seen and heard complaints that some scanner/OCR programs are saving files that aren't searchable and yours is one of them. Try opening one of the files in Preview and resaving it.

  • SAP Forums (Jive) and TREX 7.1 search for content in attachements

    Hi
    I'm trying to find out if and how its possible to set TREX 7.1 up to index content and attachments in Jive forums. I've found a statement saying that portal search dosent work for Forums (EP-COL-APP-FOR).
    Does anybody know if this can be done and then how ?
    Of course I need a search UI for Forums if the standard one dosent work..
    We are talking EP7.0 with Forums 7.00 sp 18.
    Brgds Henrik

    Hi Herik,
    you can configure TREX to index the forum repository manager and by that search forums, categories, threads and messages.
    Have a look at this link for more information:
    http://help.sap.com/saphelp_nw70/helpdata/EN/47/17904a21fa3696e10000000a11466f/frameset.htm
    Hope this helps,
    Robert

Maybe you are looking for