Public String getkeywordanalyzerstringfromserver (string tablename, string fieldname, string keywords, int cachetimeout, out string byspace) {stringbuilder sb = new stringbuilder (); sb. appendformat ("Exec sp_fieldanalyze '{0}', '{1}', '{2}', 'sqlclient'", tablename. replace ("'", "'' "), fieldname. replace ("'", "'' "), keywords. replace ("'", "'' "); system. data. dataset dssp = new maticsoft. bll. job_job (). joblist (sb. tostring (); stringbuilder result = new stringbuilder (); stringbuilder byspacesb = new stringbuilder (); foreach (system. data. datarow row in dssp. tables [0]. rows) {string word = row ["word"]. tostring (). replace ("'", "'' "); byspacesb. appendformat ("{0}", word); result. appendformat ("{0} ^ {1} ^ {2}", word, row ["rank"], row ["position"]);} byspace = byspacesb. tostring (). trim (); return result. tostring (). trim ();}
Strkeyword = getkeywordanalyzerstringfromserver ("job_job_select", "jobtitle", keyword, Int. maxvalue, out wordssplitbyspace );
Word splitting table name and field (for example, pangu for title and English for content). If you enter the title, the score is pangu, and the score for content is English, because different fields may have different word Divider
) Keywords to be segmented
If you want to precisely search words, such as advanced user inputProgramMember Lenovo China is displayed only when there are senior programmers and Lenovo In the title
Just change the foreach above.
Foreach (System. Data. datarow row In Table. Rows)
{
String WORD = string. empty;
If (Table. Rows. Count>1 )
{
WORD = row [ " Word " ]. Tostring (). Replace ( " ' " , " '' " );
Byspacesb. appendformat ( " {0} " , Word );
Result. appendformat ( " {0} ^ {1} ^ {2} ^ 0 " , Word, row [ " Rank " ], Row [ " Position " ]);
}
Else
{
WORD = row [ " Word " ]. Tostring (). Replace ( " ' " , " '' " );
Byspacesb. appendformat ( " {0} " , Word );
Result. appendformat ( " {0} ^ {1} ^ {2} ^ 1 " , Word, row [ " Rank " ], Row [ " Position " ]);
}
}
You can see the result. appendformat ("{0} ^ {1} ^ {2} ^ 1", word, row ["rank"], row ["position"]); if one parameter is added, the value 0 indicates that the parameter is equal to 1 or
Note: this parameter is valid only when the search is contains and the match parameter is invalid.