Coldfusion 如何处理Mura西班牙语网站中的重音字符
我遇到的问题是,当用户在西班牙网站上时,如果他们键入的单词不正确,他们将无法看到所有结果。也就是说,如果他们的字符没有字符上方的重音,结果将显示为空白 例如,如果用户键入单词“Medico”而在“é”顶部没有重音,搜索将返回空白 我使用的是一个Mura,一个搜索创建的CMS。我能够找到它根据用户输入进行搜索的函数。但是,我无法清楚地理解查询是如何实现的 我试图修改该函数,使其使用排序规则,我发现了一个关于如何在上使用的示例,该示例将处理西班牙语或任何其他语言的重音 我认为它应该在“where”后面加上一个cfif语句,如果它是西班牙语站点,那么它应该在其中包含排序规则Coldfusion 如何处理Mura西班牙语网站中的重音字符,coldfusion,mura,accent-insensitive,Coldfusion,Mura,Accent Insensitive,我遇到的问题是,当用户在西班牙网站上时,如果他们键入的单词不正确,他们将无法看到所有结果。也就是说,如果他们的字符没有字符上方的重音,结果将显示为空白 例如,如果用户键入单词“Medico”而在“é”顶部没有重音,搜索将返回空白 我使用的是一个Mura,一个搜索创建的CMS。我能够找到它根据用户输入进行搜索的函数。但是,我无法清楚地理解查询是如何实现的 我试图修改该函数,使其使用排序规则,我发现了一个关于如何在上使用的示例,该示例将处理西班牙语或任何其他语言的重音 我认为它应该在“where”后
<cfif #siteID# = "SpanishSite" />
//here would go the collation on keywords, titles, etc.
//这里将整理关键字、标题等。
请注意,查询是在coldfusion中完成的:
<cffunction name="getPublicSearch" returntype="query" access="public" output="false">
<cfargument name="siteid" type="string" required="true">
<cfargument name="keywords" type="string" required="true">
<cfargument name="tag" type="string" required="true" default="">
<cfargument name="sectionID" type="string" required="true" default="">
<cfargument name="categoryID" type="string" required="true" default="">
<cfargument name="tagGroup" type="string" required="true" default="">
<cfset var rsPublicSearch = "">
<cfset var w = "">
<cfset var c = "">
<cfset var categoryListLen=listLen(arguments.categoryID)>
<cfquery attributeCollection="#variables.configBean.getReadOnlyQRYAttrs(name='rsPublicSearch',maxrows=1000)#">
<!--- Find direct matches with no releasedate --->
select tcontent.contentid,tcontent.contenthistid,tcontent.siteid,tcontent.title,tcontent.menutitle,tcontent.targetParams,tcontent.filename,tcontent.summary,tcontent.tags,
tcontent.restricted,tcontent.releaseDate,tcontent.type,tcontent.subType,
tcontent.restrictgroups,tcontent.target ,tcontent.displaystart,tcontent.displaystop,0 as Comments,
tcontent.credits, tcontent.remoteSource, tcontent.remoteSourceURL,
tcontent.remoteURL,tfiles.fileSize,tfiles.fileExt,tcontent.fileID,tcontent.audience,tcontent.keyPoints,
tcontentstats.rating,tcontentstats.totalVotes,tcontentstats.downVotes,tcontentstats.upVotes, 0 as kids,
tparent.type parentType,tcontent.nextn,tcontent.path,tcontent.orderno,tcontent.lastupdate, tcontent.created,
tcontent.created sortdate, 0 priority,tcontent.majorVersion, tcontent.minorVersion, tcontentstats.lockID, tcontentstats.lockType,
tcontent.expires,tfiles.filename as assocFilename, tcontentfilemetadata.altText as fileAltText,
CASE WHEN tcontent.title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#renderTextParamValue(arguments.keywords)#">
or tcontent.menuTitle = <cfqueryparam cfsqltype="cf_sql_varchar" value="#renderTextParamValue(arguments.keywords)#"> THEN 0 ELSE 1 END AS superSort
from tcontent Left Join tfiles ON (tcontent.fileID=tfiles.fileID)
Left Join tcontent tparent on (tcontent.parentid=tparent.contentid
and tcontent.siteid=tparent.siteid
and tparent.active=1)
Left Join tcontentstats on (tcontent.contentid=tcontentstats.contentid
and tcontent.siteid=tcontentstats.siteid)
Left Join tcontentfilemetadata on (tcontent.fileid=tcontentfilemetadata.fileid
and tcontent.contenthistid=tcontentfilemetadata.contenthistid)
<cfif len(arguments.tag)>
Inner Join tcontenttags on (tcontent.contentHistID=tcontenttags.contentHistID)
</cfif>
where
(tcontent.Active = 1
AND tcontent.Approved = 1
AND tcontent.siteid = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.siteID#"/> )
AND
(
tcontent.Display = 2
AND
(
(tcontent.DisplayStart <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
AND (tcontent.DisplayStop >= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#"> or tcontent.DisplayStop is null)
)
OR tparent.type='Calendar'
)
OR tcontent.Display = 1
)
AND
tcontent.type in ('Page','Folder','Calendar','File','Link','Gallery')
AND tcontent.releaseDate is null
<cfif len(arguments.sectionID)>
and tcontent.path like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#arguments.sectionID#%">
</cfif>
<cfif len(arguments.tag)>
and (
#renderTextParamColumn('tcontenttags.tag')# in (<cfqueryparam list="true" cfsqltype="cf_sql_varchar" value="#renderTextParamValue(arguments.tag)#"/> )
<cfif len(arguments.tagGroup) and arguments.tagGroup neq 'default'>
and #renderTextParamColumn('tcontenttags.taggroup')#=<cfqueryparam cfsqltype="cf_sql_varchar" value="#renderTextParamValue(arguments.taggroup)#"/>
</cfif>
)
<cfelse>
<!---
<cfloop list="#trim(arguments.keywords)#" index="w" delimiters=" ">
and
(tcontent.Title like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">
or tcontent.menuTitle like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">
or tcontent.metaKeywords like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">
or tcontent.summary like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">
or tcontent.body like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">)
</cfloop>
--->
and
(#renderTextParamColumn('tcontent.Title')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or #renderTextParamColumn('tcontent.menuTitle')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or #renderTextParamColumn('tcontent.metaKeywords')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or #renderTextParamColumn('tcontent.summary')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or (
tcontent.type not in ('Link','File')
and #renderTextParamColumn('tcontent.body')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
)
or #renderTextParamColumn('tcontent.credits')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or tcontent.contenthistid in (
select distinct tcontent.contenthistid from tclassextenddata
inner join tcontent on (tclassextenddata.baseid=tcontent.contenthistid)
where tcontent.active=1
and tcontent.siteid=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.siteID#"/>
and #renderTextParamColumn('tclassextenddata.attributeValue')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
))
</cfif>
and tcontent.searchExclude=0
<cfif categoryListLen>
and tcontent.contentHistID in (
select tcontentcategoryassign.contentHistID from
tcontentcategoryassign
inner join tcontentcategories
ON (tcontentcategoryassign.categoryID=tcontentcategories.categoryID)
where (<cfloop from="1" to="#categoryListLen#" index="c">
tcontentcategories.path like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#listgetat(arguments.categoryID,c)#%"/>
<cfif c lt categoryListLen> or </cfif>
</cfloop>)
)
</cfif>
#renderMobileClause()#
union all
<!--- Find direct matches with releasedate --->
select tcontent.contentid,tcontent.contenthistid,tcontent.siteid,tcontent.title,tcontent.menutitle,tcontent.targetParams,tcontent.filename,tcontent.summary,tcontent.tags,
tcontent.restricted,tcontent.releaseDate,tcontent.type,tcontent.subType,
tcontent.restrictgroups,tcontent.target ,tcontent.displaystart,tcontent.displaystop,0 as Comments,
tcontent.credits, tcontent.remoteSource, tcontent.remoteSourceURL,
tcontent.remoteURL,tfiles.fileSize,tfiles.fileExt,tcontent.fileID,tcontent.audience,tcontent.keyPoints,
tcontentstats.rating,tcontentstats.totalVotes,tcontentstats.downVotes,tcontentstats.upVotes, 0 as kids,
tparent.type parentType,tcontent.nextn,tcontent.path,tcontent.orderno,tcontent.lastupdate, tcontent.created,
tcontent.releaseDate sortdate, 0 priority,tcontent.majorVersion, tcontent.minorVersion, tcontentstats.lockID, tcontentstats.lockType,
tcontent.expires,tfiles.filename as assocFilename, tcontentfilemetadata.altText as fileAltText,
CASE WHEN tcontent.title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#renderTextParamValue(arguments.keywords)#">
or tcontent.menuTitle = <cfqueryparam cfsqltype="cf_sql_varchar" value="#renderTextParamValue(arguments.keywords)#"> THEN 0 ELSE 1 END AS superSort
from tcontent Left Join tfiles ON (tcontent.fileID=tfiles.fileID)
Left Join tcontent tparent on (tcontent.parentid=tparent.contentid
and tcontent.siteid=tparent.siteid
and tparent.active=1)
Left Join tcontentstats on (tcontent.contentid=tcontentstats.contentid
and tcontent.siteid=tcontentstats.siteid)
Left Join tcontentfilemetadata on (tcontent.fileid=tcontentfilemetadata.fileid
and tcontent.contenthistid=tcontentfilemetadata.contenthistid)
<cfif len(arguments.tag)>
Inner Join tcontenttags on (tcontent.contentHistID=tcontenttags.contentHistID)
</cfif>
where
(tcontent.Active = 1
AND tcontent.Approved = 1
AND tcontent.siteid = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.siteID#"/> )
AND
(
tcontent.Display = 2
AND
(
(tcontent.DisplayStart <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
AND (tcontent.DisplayStop >= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#"> or tcontent.DisplayStop is null)
)
OR tparent.type='Calendar'
)
OR tcontent.Display = 1
)
AND
tcontent.type in ('Page','Folder','Calendar','File','Link','Gallery')
AND tcontent.releaseDate is not null
<cfif len(arguments.sectionID)>
and tcontent.path like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#arguments.sectionID#%">
</cfif>
<cfif len(arguments.tag)>
and (
#renderTextParamColumn('tcontenttags.tag')# in (<cfqueryparam list="true" cfsqltype="cf_sql_varchar" value="#renderTextParamValue(arguments.tag)#"/> )
<cfif len(arguments.tagGroup) and arguments.tagGroup neq 'default'>
and #renderTextParamColumn('tcontenttags.taggroup')#=<cfqueryparam cfsqltype="cf_sql_varchar" value="#renderTextParamValue(arguments.taggroup)#"/>
</cfif>
)
<cfelse>
<!---
<cfloop list="#trim(arguments.keywords)#" index="w" delimiters=" ">
and
(tcontent.Title like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">
or tcontent.menuTitle like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">
or tcontent.metaKeywords like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">
or tcontent.summary like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">
or tcontent.body like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#w#%">)
</cfloop>
--->
and
(#renderTextParamColumn('tcontent.Title')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or #renderTextParamColumn('tcontent.menuTitle')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or #renderTextParamColumn('tcontent.metaKeywords')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or #renderTextParamColumn('tcontent.summary')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or
(
tcontent.type not in ('Link','File')
and #renderTextParamColumn('tcontent.body')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
)
or #renderTextParamColumn('tcontent.credits')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
or tcontent.contenthistid in (
select distinct tcontent.contenthistid from tclassextenddata
inner join tcontent on (tclassextenddata.baseid=tcontent.contenthistid)
where tcontent.active=1
and tcontent.siteid=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.siteID#"/>
and #renderTextParamColumn('tclassextenddata.attributeValue')# like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#renderTextParamValue(arguments.keywords)#%">
))
</cfif>
and tcontent.searchExclude=0
<cfif categoryListLen>
and tcontent.contentHistID in (
select tcontentcategoryassign.contentHistID from
tcontentcategoryassign
inner join tcontentcategories
ON (tcontentcategoryassign.categoryID=tcontentcategories.categoryID)
where (<cfloop from="1" to="#categoryListLen#" index="c">
tcontentcategories.path like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#listgetat(arguments.categoryID,c)#%"/>
<cfif c lt categoryListLen> or </cfif>
</cfloop>)
)
</cfif>
#renderMobileClause()#
ORDER BY supersort, priority, <cfif variables.configBean.getDBType() neq 'nuodb'>sortdate<cfelse>releasedate</cfif> desc
</cfquery>
<cfreturn rsPublicSearch />
选择tcontent.contentid、tcontent.contenthistid、tcontent.siteid、tcontent.title、tcontent.menutile、tcontent.targetParams、tcontent.filename、tcontent.summary、tcontent.tags、,
tcontent.restricted,tcontent.releaseDate,tcontent.type,tcontent.subType,
tcontent.restrictgroups、tcontent.target、tcontent.displaystart、tcontent.displaystop、0作为注释,
tcontent.credits、tcontent.remoteSource、tcontent.remoteSourceURL、,
tcontent.remoteURL、tfiles.fileSize、tfiles.fileExt、tcontent.fileID、tcontent.acquisition、tcontent.keyPoints、,
tcontentstats.rating,tcontentstats.TotalVoces,tcontentstats.DownVoces,tcontentstats.UpVoces,0作为孩子,
tparent.type parentType,tcontent.nextn,tcontent.path,tcontent.orderno,tcontent.lastupdate,tcontent.created,
tcontent.created sortdate,0优先级,tcontent.majorVersion,tcontent.minorVersion,tcontentstats.lockID,tcontentstats.lockType,
tcontent.expires,tfiles.filename作为assocFilename,tcontentfilemetadata.altText作为fileAltText,
当tcontent.title=
或tcontent.menuTitle=然后0,否则1结束作为超级排序
从tcontent Left开始在上连接tfiles(tcontent.fileID=tfiles.fileID)
左连接tcontent tparent打开(tcontent.parentid=tparent.contentid
而tcontent.siteid=tparent.siteid
和tparent.active=1)
左键连接tcontentstats on(tcontent.contentid=tcontentstats.contentid
和tcontent.siteid=tcontentstats.siteid)
左键连接上的tcontentfilemetadata(tcontent.fileid=tcontentfilemetadata.fileid
和tcontent.contenthistid=tcontentfilemetadata.contenthistid)
上的内部联接tcontenttags(tcontent.contentHistID=tcontenttags.contentHistID)
哪里
(t content.Active=1
和t内容。已批准=1
和tcontent.siteid=)
及
(
t内容显示=2
及
(
(tcontent.DisplayStart=或tcontent.DisplayStop为空)
)
或tparent.type='Calendar'
)
或tcontent.Display=1
)
及
t输入('Page'、'Folder'、'Calendar'、'File'、'Link'、'Gallery')
而tcontent.releaseDate为空
和tcontent.path-like
及(
#renderTextParamColumn('tcontenttags.tag')#在()
和#renderTextParamColumn('tcontenttags.taggroup'))#=
)
和
(#renderTextParamColumn('tcontent.Title')#类似
或者#renderTextParamColumn('tcontent.menutile')#类似
或#renderTextParamColumn('tcontent.metaKeywords')#如
或者#renderTextParamColumn('tcontent.summary')#类似
或(
tcontent.type不在('Link','File')中
和#renderTextParamColumn('tcontent.body')#类似
)
或#renderTextParamColumn('tcontent.credits')#如
或中的tcontent.contenthistid(
从tclassextenddata中选择distinct tcontent.contenthistid
上的内部联接tcontent(tclassextenddata.baseid=tcontent.contenthistid)
其中tcontent.active=1
和tcontent.siteid=
和#renderTextParamColumn('tclassextenddata.attributeValue')#类似
))
和tcontent.searchExclude=0
和中的tcontent.contentHistID(
从中选择tContentCategorySign.contentHistID
t内容分类分配
内部联接内容类别
打开(tContentCategorySign.categoryID=tcontentcategories.categoryID)
在哪里(
tcontentcategories.path-like
或
)
)
#rendermobilecause()#
联合所有
选择tcontent.contentid、tcontent.contenthistid、tcontent.siteid、tcontent.title、tcontent.menutile、tcontent.targetParams、tcontent.filename、tcontent.summary、tcontent.tags、,
tcontent.restricted,tcontent.releaseDate,tcontent.type,tcontent.subType,
tcontent.restrictgroups、tcontent.target、tcontent.displaystart、tcontent.displaystop、0作为注释,
tcontent.credits,tcontent.remoteSource,tcont
const userInput = 'Médico';
const parsedInput = userInput.replace(/é/gmi, 'e').toLowerCase();