Implement support for logical search/Word search/Phrase search + support Or/and keywords of the VBS CLASS

Source: Internet
Author: User
Tags gettext ming
class function. Replaces the passed-in string as an expression following the SQL statement where keyword:
Word search [For example: Xiaoming]

Phrase Search
Every word in a phrase will be retrieved
For example: Xiao Qiang 1 nickname 1 small powerful small cockroach

Logical Search
Supports the and and OR operators.
For example: Xiaoming and Xiao Qiang
Compound Condition:
For example: (Small Ming or Xiao Ming) and (Xiao Qiang or Xiao Qiang)
For example: (Small Ming Or nickname) and Xiao Qiang
For example: ROOT1 and (Cantonese Or Peking people)
-----------------------------------------------------------
Class createquerystring
Public Objreg
Public Intstart
Public Strfield
Private ObjNode2
Private StrText
Public Property Let QueryString (strvalue)
StrText = Lcase (strvalue)
End Property

Private Sub Class_Initialize ()
Set Objreg = new REGEXP
Strfield = "(title + article)"
End Sub

Private Sub Class_Terminate ()
Set Objreg = Nothing
End Sub
Public Default Function GetText ()
Dim Blnres
Dim Strsky
With Objreg
. IgnoreCase = True
. Global = True
. Pattern = "s"
Blnres =. Test (StrText)
End With
If (not blnres) Then
Intstart = 2
GetText = Strfield & "Like '%" & strText & "%"
Else
Objreg.pattern = "Sand|sor"
Blnres = Objreg.test (StrText)
If Blnres Then
Strsky = Check ()
If Strsky = False Then
GetText = Wahaha ()
Else
GetText = Strsky
End If
Else
GetText = Wahaha ()
End If
End If
End Function

Private Function Wahaha ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.