Wie Verwenden Sie Custom1, Custom2, Custom3, Custom4 in mit Solr?
-
23-10-2019 - |
Frage
Do Custom1, Custom2, Custom3, Custom4 Attribut von <cfsearch>
Mit Solr arbeiten? In der Dokumentation heißt es, dass sie nur für Verity übereinstimmen. So verwenden Sie CustomX mit Solr in <cfsearch>
?
Vielen Dank
Lösung
Ja, das tun sie. Hier ist ein Beispiel:
Aufbau der SammlungDie Saiten sind Spaltennamen. Beispielsweise ist 'Schlüsselwörter' eine gültige Spalte in der Abfrage "Qindex".
<cfindex collection = "#arguments.collectionName#"
action = "REFRESH"
type = "CUSTOM"
body = "Show_Name, Title"
key = "theKey"
custom1 = "Show_Description"
custom2 = "keywords"
custom3 = "Show_ID"
custom4 = "Asset_ID"
title = "Title"
query = "qIndex"
URLPath = "theURL" />
Durchsuchen der Sammlung
<!--- Populate the remaining attributes of the cfsearch tag --->
<cfif !structKeyExists(arguments, 'searchArgs')>
<cfset arguments.searchArgs = {
collection = arguments.collectionName
,criteria = "#arguments.term#"
,contextPassages = "1"
,contextBytes = "1024"
,suggestions = "always"
,status = "searchStatus" } />
</cfif>
<!--- Force the name of the result as its referenced only internally --->
<cfset arguments.searchArgs.name = 'qSearchResults' />
<!--- Try to search our collection using Solr --->
<cfsearch attributecollection="#arguments.searchArgs#" />
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow