Does Microsoft Access have Full Text Search?

后端 未结 6 1813
闹比i
闹比i 2021-01-11 14:47

Does Microsoft Access have Full Text Search?

I know that MySQL and SQL Server have Full Text Search, but I am not too certain on Access.

If Access doesn\'t h

相关标签:
6条回答
  • 2021-01-11 15:17

    Access is not a database. But it does ship with a default database engine, Jet/ACE. I would assume that's what you mean, but you should be more clear what you mean when you ask a question like this.

    Jet/ACE does not have any full-text search capabilities.

    The best way to do full-text search of Jet/ACE data files is through whatever full-text search capabilities you have for files on your computer. This is not going to be fast, nor is it going to be usable via SQL.

    You don't say what context this is, but I have in general never seen a need for full-text search except on websites (where it's something of an expected capability). If you're using Jet/ACE as the datastore for an HTTP application, then you've chosen the wrong data store. While Jet/ACE can work fine for low-volume read-only websites, that's not an advisable usage (because of limitations in the Jet/ACE database engine).

    If you need full-text searching then you need a different database engine.

    0 讨论(0)
  • 2021-01-11 15:18

    I'm not 100% certain, but the fact that this site from Microsoft doesn't mention Access suggests to me that the answer is "no".

    My gut reaction would also be "no". Access wasn't intended to be the ne plus ultra in relational database technology. If it were, there'd be no reason for SQL Server.

    0 讨论(0)
  • 2021-01-11 15:30

    The first step in full text searching is to create a word list containing all the words in the database. Full text searching also has other features like stemming, which relates derived words to a base word (fast, faster, fastest) and it has stop words which are ignored because they are so common (and, the). A little VBA code can generate a word list which can be visually scanned. With a little more work, it would be possible to use code to check the word list first before searching the database and this might make searches much faster. Below is some code that I created for the purpose. Its real life application is to find peoples names in database so that I can remove or alter them for privacy protection and as a biologist, I want to italicize scientific names in reports. If I can create a list of scientific names, then I can replace them with the name enclosed in html tags.

    The code works well but I have not tested it extensively or against large memo fields/rich text fields. It was written in Access 2010.

    'This code requires a table called tblWordList with fields called Word (str 255), WordCount (long), FirstCopyID (long)
    
    Option Compare Database
    Option Explicit
    
    'Click on this procedure and press F5 to run the code
    Private Sub ScopeWordList()
    
        'A list of tables and fields that need to be processed
        Call CreateWordList("Issues", "IssueSummary", "IssueID")
    
    End Sub
    
    'The main routine that finds new words
    Public Sub CreateWordList(TableName As String, FieldName As String, ForeignKey As String)
    
        Dim dbs As Database
        Dim rst As Recordset
        Dim SQL_Statement As String
    
        Dim r As Recordset
    
        Dim RowText As String
        Dim OriginalWord As String
        Dim SearchWord As String
        Dim SearchTerm As String
        Dim Quote As String: Quote = Chr$(34)
        Dim i As Long
        Dim RecNum As Long
    
        SQL_Statement = "SELECT " & FieldName & ", " & ForeignKey & " AS FirstCopyID FROM " & TableName & " WHERE " & FieldName & " IS NOT NULL;"
        Set dbs = CurrentDb()
        Set rst = dbs.OpenRecordset(SQL_Statement, dbOpenSnapshot)
    
        Set r = dbs.OpenRecordset("tblWordCounts", dbOpenTable)
        r.Index = "Word"
    
        With rst
        If .RecordCount = 0 Then GoTo ExitCreateWordList
    
        Do Until .EOF
            Dim RowWords As Variant 'holds an array which needs to be created
            RowText = .Fields(0)
            'strip out quotes, slashes and other characters
            RowText = CleanLine(RowText)
            'split data into words
            RowWords = Split(RowText, Space(1))
    
            For i = LBound(RowWords) To UBound(RowWords)
                OriginalWord = RowWords(i)
                SearchWord = Left(Trim(OriginalWord), 254)
                If Len(SearchWord) > 0 Then
                        r.Seek "=", SearchWord
                        If r.NoMatch Then
                            r.AddNew
                            r!Word = SearchWord
                            r!wordcount = 1
                            'records ID field of first occurrence, so you can debug unexpected results
                            r!FirstCopyID = !FirstCopyID
                            r.Update
                        Else
                            r.Edit
                            r!wordcount = r!wordcount + 1
                            r.Update
                        End If
                    End If
    '            End If
            Next i
            RecNum = RecNum + 1
            If RecNum Mod 20 = 0 Then Debug.Print "Record " & RecNum
            .MoveNext
        Loop
    
    ExitCreateWordList:
        End With
        Debug.Print "Done"
        Set rst = Nothing
        Set dbs = Nothing
    
    
    End Sub
    
    'Need to clean out unwanted characters and replace then with normal spaces
    Private Function CleanLine(RowText As String) As String
    
            Dim X As Long
            Dim Y As String
            Dim Z As Long
            Dim W As String
    
            For X = 1 To Len(RowText)
                Y = Mid(RowText, X, 1)
                Z = Asc(Y)
                Select Case Z
                    Case 65 To 90      'capital letters
                        W = W & Y
                    Case 97 To 122     'lowercase letters
                        W = W & Y
                    Case Else
                        W = W & Space(1)
                End Select
            Next
            CleanLine = W
    
    End Function
    
    'Delete all records in Word List table
    Public Sub ClearWordList()
    
        Dim SQL_Statement As String
    
        'Delete all records from tblWordCounts
        SQL_Statement = "DELETE FROM tblWordCounts"
        DoCmd.SetWarnings False
        DoCmd.RunSQL SQL_Statement
        DoCmd.SetWarnings True
    
    End Sub
    
    0 讨论(0)
  • 2021-01-11 15:33

    http://www.dummies.com/how-to/content/finding-records-in-your-access-2003-tables.html

    It's about using the find tool. I haven't tried it yet and I'm not sure if it works on memo fields.

    0 讨论(0)
  • 2021-01-11 15:34

    MSDE (now called Sql Server Express) has full-text indexing, if you're looking for a client-deployable database

    0 讨论(0)
  • 2021-01-11 15:37

    The sample code that @duffymo provides works very well. I use it with Microsoft Access 2003. But a couple of fixes are necessary.

    1. The table needs to be defined as: 'This code requires a table called tblWordList with fields called Word (text 255), WordCount (number), FirstCopyID (number)

    2. The other fix is tblWordCounts needed to be replaced with tblWordList, and of course the Call CreateWordList needed to be changed to the table and field that needed to be sent to tblWordList.

    On a 5000 record table it ran so fast I thought that it didn't work when I clicked on Sub ScopeWordList() and pressed F5, but the module created a word list with over 700 distinct records (for my data table). Thanks @duffymo for some neat example code.

    0 讨论(0)
提交回复
热议问题