When I use the built in vertiy search engine, everything works fine except my resul ts page provides duplicates of every result. I am using. Actually, you have two great engines for CF9: Verity (classic) and Solr (modern). Both of them implement the idea of collections. Creating and maintanence of the . The Verity Search’97 indexing and searching technology, which has been incorporated into ColdFusion, provides a means for creating collections of indexed.
|Published (Last):||27 June 2013|
|PDF File Size:||5.86 Mb|
|ePub File Size:||3.62 Mb|
|Price:||Free* [*Free Regsitration Required]|
The Verity text search engine is one of the best features of ColdFusion, but is often ignored altogether by developers. This article will tell you how to use Verity to add the power of an internet-style search engine to the front door of your web application with little effort and complete control in CF code. We cover all cooldfusion basics of using the Verity search engine, with a focus specifically on indexing SQL queries. If you are interested in also searching documents or other text such as CFHTTP result sets with Verity you will also benefit from this article, as all the same principles apply.
It provides a full-text search service, which can be directed at web pages, documents, database queries and even your own custom textual searches such as CFHTTP result sets. The award-winning Verity search engine was created by the Verity Corporation and has been around for several years.
The use of their technology is ubiquitous on Internet sites and on non-web based venues e. Since it is designed to do nothing but text searches, vrity is extremely fast, and efficient at doing so.
Coldfusion verity search indexes duplicates | Adobe Community
Verity provides flexibility and functionality that would take a lot of effort to provide using only ColdFusion and SQL code. Plus it runs hundreds of times faster to veritg Imagine how useful it would be to be able to easily implement a full text search on your website. Think of all the uses you could have of indexing databases and searching for records without needing to rely on using SQL queries to do so.
The first time you use the Verity search engine, expect to spend a little time getting started. To say the least, there are a few concepts that you need to clodfusion, but the basics are quite easy to get. Really there are only three tags that you cooldfusion need to know how to use. If you already have a collection to work with, all you need to do is employ this tag to extract search results. This is all discussed in further detail later on.
Meanwhile lets get started looking at the nuts and bolts of how to vdrity Verity work for you. Actually, using this tag is optional, because the ColdFusion Administrator also provides the same functionality. This makes sense—you have to define the index before you can use it to hold data or search it.
Basically, this tag is used to index your website files or your database. Depending on the circumstances, you can either do one record at a time or index the entire database in one go. Oftentimes you need to choose the former as a matter of course. For instance, in the case of our contacts database, its much more practical to index the records as they are added to the database. Furthermore, it should be noted that indexing data is extremely CPU intensive.
If you are indexing a large amount of data you should at least do it during off-hours using the scheduler in the ColdFusion administrator.
First, you must query your database to return the records you wish to index: Notice that we do not use signs around our column names. Body contains the names of fields that are in your database which are returned by your query.
This is one of the pitfalls of using Verity. The reason why is that this will confuse the Indexing engine and cause it to fail with no error messages displayed —it will just stop indexing. This is especially useful because you may have more than one index of information you might want to search simultaneously for the same keywords.
It searches two collections Collection1 and Collection2 for any records that contain the word Bethesda and a word verihy with the letters C-O-H but that does NOT contain the word Eron:. Naturally, in the real world, you would probably have a form field or some other mechanism for ascertaining the search criteria.
You could do something to this to output all the values from the key field:. Or better yet, you could just access them all at once voldfusion the valuelist function:.
Indexing Data with Verity
You will need to develop some sort of appropriate interface to handle and display the results of the search. In our case the filename and path. As stated earlier, you would usually want to index records as they are added to your database instead of en masse. In summary, the way veity accomplish this is by first adding your record to the database and then using that query to index the data you added If you are using autonumber key fields you will verjty to do a couple of extra steps: The process is similar to adding a vfrity record to the index.
This is where some of the real power of the Verity search engine kicks in. Make sure you have a good help page drawn up to let your users know what they can do with Verity. Lets have a look at a few of the best of these:. You can enter comma-delimited strings and use wildcard characters regular expressions. By vsrity, a simple query searches for words, not strings.
For example, entering the word “all” will find documents containing the word “all” but not “allegorical. You can enter multiple words separated by commas: The comma in a Simple query expression is treated like a logical OR.
If you omit the commas, the query expression is treated as a phrase, so documents would be searched for the phrase “software Microsoft Oracle. To include an operator in a search, you surround it with double quotation marks: This expression searches for the phrase “software and Microsoft. STEM searches for words that derive from those entered in the query expression, so that entering “find” will return documents that contain “find,” “finding,” “finds,” etc. The MANY modifier forces the documents returned in the search to be presented in a list based on a relevancy score.
For a full list of Verity operators see the on-line help page at our knowledge base page http: You may also want to poke around the Verity Inc. When used before a search word, Verity also finds words that are synonyms to the search word that it modifies.
I’ve tested both operators and they both work great! Using Verity as part of ColdFusion is not without its foibles. There are definitely some things a developer needs to be aware of so that they can steer-clear of potential problems.
First of all, the Verity indexes tend to get bloated after a while. Note that no processes can be using a collection at the same time it’s being updated.
If it is then you will get memory leaks on coldfusioj CF server and it will eventually crash. In order to prevent oversized collections, you may find the need to divide your indexes into more than one collection. Luckily, Allaire makes it very easy to search multiple indexes simultaneously.
Putting it all together code example. Here are some simple ColdFusion templates to help you get started.
MD ColdFusion User’s Group
It will need the following fields along with a few rows of example data: You should save these templates to a directory on your server and then run them in the order that they are listed here. The Verity wizard will most likely be the last one in your list, as pictured in the adjacent image. The wizard is actually designed for generating pages that index and search static HTML web pages, but they do give a good start for other kinds of work and are very easy to recycle for other types of Verity searches.
If you own ColdFusion Studio, they are definitely worth examining! Make sure you have a directory on your server called c: For this to work, you need to make sure you have the database available! You can download the example database or create a table in your own datasource. This was borrowed from the ColdFusion Studio Verity wizard. It is mainly used to generate code for indexing websites not queries!
Up to the specified Max. Verity is a great text searching tool and is worth adding to your CF skill set. We also covered creating custom verity indices of any text you have in a CF page and various pitfalls in using verity in CF. Chapter 29 of “The ColdFusion 4. Michael Smith is president of TeraTech http: You can reach Michael at michael teratech.
How Do I Use Verity Collections?
Getting started with Verity The first time you use the Verity search engine, expect to spend a little time getting started. It searches two collections Collection1 and Collection2 for any records that contain the word Bethesda and a word starting with the letters C-O-H but that does NOT contain the word Eron: You could do something to this to output all the values from the key field: Special Techniques Adding one record at a time to your index As stated earlier, you would usually want to index records as they are added to your database instead of en masse.
Updating records in your index The process is similar to adding a new record to the index. Lets have a look at a few of the best of these: What do I have to watch out for? Putting it all together code example Here are some simple ColdFusion templates to help you get started.
This will index the entire database table. Gather input for search. Sunday, September 03, Comments: