sql server full-text search

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default sql server full-text search

    Does anyone have experience with storing documents (word, excel, pdf, etc) in
    sql server as a binary object, and then using the full-text catalogs to search
    for data within the binary object (just like verity)? I am able to insert a
    binary object into a database table, and retrieve the object, but I am unable
    to search the contents of the file using the full-text capabilities of sql
    server.

    If anyone has been able to do what I've described, could you please offer some
    advice?

    Here is the code I use to upload/insert a record into the database:

    <!--- Get binary file. --->
    <CFFILE ACTION="readbinary" FILE="#txtTempUploadDir#\#txtNewFileName#"
    VARIABLE="binary_file">

    <CFQUERY NAME="qryNewFile" DATASOURCE="#Request.dsnSQLDB#">
    INSERT INTO tblFileRepository(Type, objFile, txtFileName, txtTitle,
    txtDescription, txtPOC, txtFormat,
    txtSize, dateUploadDate, txtUploadedBy, intFileAreaID)
    VALUES('#txtType#', <cfqueryparam cfsqltype="cf_sql_blob"
    value="#binary_file#">, '#txtNewFileName#', '#attributes.txtTitle#',
    '#attributes.txtDescription#', '#attributes.txtPOC#',
    '#attributes.txtFormat#',
    '#txtSize#', #Now()#, '#USERINFO.txtUserName#', #qryAreaInfo.intFileAreaID#)
    SELECT @@IDENTITY AS intNewID
    </CFQUERY>

    I then use the following query to try and retrieve information:

    SELECT *
    FROM tblFileRepository
    WHERE CONTAINS (*, ' "document" ')

    The word 'document' is within the file that is uploaded/inserted.

    I followed the instructions in the following article when setting up my
    catalog:

    [url]http://www.databasejournal.com/features/mssql/article.php/3486331[/url]

    The article has a .net slant, so I am starting to think that the problem is
    how I am inserting the object into the database. Perhaps it is not in the
    correct format?

    Any help would be GREATLY appreciated.

    Thanks!

    fillae Guest

  2. Similar Questions and Discussions

    1. mySQL and Full Text Search
      MS SQL 2000 will only do a full text search on one table column - I can't do a full-text search on the text data in two table columns, only one. ...
    2. Basic problem installing TSearch2 (full text search)
      Hi all, I've installed TSearch2 with some success- my table now contains a tsvector field that's indexed and I can run full text queries. ...
    3. bilingual Full text search
      Hi folks, I want to make a full text search CD for 5000 html files in english and arabic. I already tried the following solutions.... 1) I...
    4. Regular Expression for SQL Server full-text search
      Hi Michal, Make sure your Regular Expression Validator has EnableClientScript set to true. This should cause the validator to display its error...
    5. full text search
      i found that sql-server full text search is only capable of searching the newly inserted items after an incremental or full population. Is there any...
  3. #2

    Default Re: sql server full-text search

    Did you repopulate the index after uploading your files?

    "fillae" <webforumsuser@macromedia.com> wrote in message
    news:d5r9ar$2mf$1@forums.macromedia.com...
    > Does anyone have experience with storing documents (word, excel, pdf, etc)
    > in
    > sql server as a binary object, and then using the full-text catalogs to
    > search
    > for data within the binary object (just like verity)? I am able to insert
    > a
    > binary object into a database table, and retrieve the object, but I am
    > unable
    > to search the contents of the file using the full-text capabilities of sql
    > server.
    >
    > If anyone has been able to do what I've described, could you please offer
    > some
    > advice?
    >
    > Here is the code I use to upload/insert a record into the database:
    >
    > <!--- Get binary file. --->
    > <CFFILE ACTION="readbinary" FILE="#txtTempUploadDir#\#txtNewFileName#"
    > VARIABLE="binary_file">
    >
    > <CFQUERY NAME="qryNewFile" DATASOURCE="#Request.dsnSQLDB#">
    > INSERT INTO tblFileRepository(Type, objFile, txtFileName, txtTitle,
    > txtDescription, txtPOC, txtFormat,
    > txtSize, dateUploadDate, txtUploadedBy, intFileAreaID)
    > VALUES('#txtType#', <cfqueryparam cfsqltype="cf_sql_blob"
    > value="#binary_file#">, '#txtNewFileName#', '#attributes.txtTitle#',
    > '#attributes.txtDescription#', '#attributes.txtPOC#',
    > '#attributes.txtFormat#',
    > '#txtSize#', #Now()#, '#USERINFO.txtUserName#',
    > #qryAreaInfo.intFileAreaID#)
    > SELECT @@IDENTITY AS intNewID
    > </CFQUERY>
    >
    > I then use the following query to try and retrieve information:
    >
    > SELECT *
    > FROM tblFileRepository
    > WHERE CONTAINS (*, ' "document" ')
    >
    > The word 'document' is within the file that is uploaded/inserted.
    >
    > I followed the instructions in the following article when setting up my
    > catalog:
    >
    > [url]http://www.databasejournal.com/features/mssql/article.php/3486331[/url]
    >
    > The article has a .net slant, so I am starting to think that the problem
    > is
    > how I am inserting the object into the database. Perhaps it is not in the
    > correct format?
    >
    > Any help would be GREATLY appreciated.
    >
    > Thanks!
    >

    ctrl+alt+delete Guest

  4. #3

    Default Re: sql server full-text search

    Yes I did. I also have Change Tracking turned on so it is updated any time there is a change to the table.
    fillae Guest

  5. #4

    Default Re: sql server full-text search

    "fillae" <webforumsuser@macromedia.com> wrote in message
    news:d5t3v0$o6e$1@forums.macromedia.com...
    > Yes I did. I also have Change Tracking turned on so it is updated any
    > time there is a change to the table.
    Well, I don't use the Full Text search capability of MS SQL Server often,
    but I tried to mimic your code on my test servers and had no trouble. My
    simplified code is as follows:

    <CFFILE action="readbinary"
    file="#Request.repository#\GFX_Textron031505.doc" variable="binary_file">

    <CFQUERY NAME="qryNewFile" DATASOURCE="#Request.DSN#">
    INSERT INTO Docs(Type, Title, Document)
    VALUES('doc', 'GFX_Textron031505.doc', <cfqueryparam
    cfsqltype="cf_sql_blob" value="#binary_file#">)
    </CFQUERY>

    <CFQUERY name="rsFiles" datasource="#Request.DSN#">
    SELECT f.*, d.*
    FROM Docs d INNER JOIN FREETEXTTABLE(Docs, *, ' "$45/hour" ') f ON d.DocID =
    f.[Key]
    </CFQUERY>

    <CFDUMP var="#rsFiles#">

    On the SQL Server, I used the script exactly as provided in the web article
    you referenced (so my table contains the bare minimum.)


    ctrl+alt+delete Guest

  6. #5

    Default Re: sql server full-text search

    After some trial and error, I was able to get it to work. The problem was with
    the 'Type' field in the database. The only way I could get it to work is if I
    defined it as a char(3).

    As a side note. The Full-Text capability works a ton better than verity for
    my application. I've been using verity for over 5 years now with success, but
    the Full-Text search in SQL server is the nuts. It's faster, plus there are no
    more collections to hassle over. JMHO.

    Thanks all.

    fillae Guest

  7. #6

    Default Re: sql server full-text search

    "fillae" <webforumsuser@macromedia.com> wrote in message
    news:d5tv04$59j$1@forums.macromedia.com...
    > After some trial and error, I was able to get it to work. The problem was
    > with
    > the 'Type' field in the database. The only way I could get it to work is
    > if I
    > defined it as a char(3).
    >
    > As a side note. The Full-Text capability works a ton better than verity
    > for
    > my application. I've been using verity for over 5 years now with success,
    > but
    > the Full-Text search in SQL server is the nuts. It's faster, plus there
    > are no
    > more collections to hassle over. JMHO.
    >
    > Thanks all.
    >
    Have you played with ranking yet?


    ctrl+alt+delete Guest

  8. #7

    Default Re: sql server full-text search

    No, I have not played with ranking. It might be a future revision.
    fillae Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139