Solr in ColdFusion needs some basic code change in creating ,indexing and searching a collection.
Creating Collection:
While creating a collection ColdFusion requires an attribute 'engine' to indentify a collection as Solr or Verity. Default value of 'engine' is verity. Defining the attribute 'engine' is one time activity, for indexing and search ColdFusion will automatically identify the collection type.
< cfcollection action="create"
collection="mysolr"key="#expandpath('.')#"
type="path"
engine="solr">
This will create a solr collection named 'mysolr'. also there is no need to define language and categories at the time of creation of collection,language can be defined at the time of indexing a collection.
Indexing Collection:
Indexing a Solr collection is similar to Verity.
< cfquery name="getCourses" datasource="cfdocexamples">For indexing a Solr collection in some other languages than English, language attribute can be defined in <> tag.
SELECT * FROM COURSES
< /cfquery>
< cfindex action="Update"
query="getCourses"
collection="mysolr"
type="Custom"
key="Course_ID"
title="Courses"
body="Course_ID,Descript"
custom1="Course_Number">
Solr supports following languages:
• Danish
• Dutch
• Finnish
• French
• German
• Italian
• Norwegian
• Spanish
• Portugese
• Russian
• Swedish
• Chinese
• Japanese
• Korean
• Czech
• Greek
• Thai
However, Solr supports indexing documents in any language. If the document has a language (for example, Arabic) not listed above, it can still index the content(as english), but stemming will not be available in search.
1 comment:
solr
Post a Comment