Webcrossing offers several different methods to search for items in the database. Best-suited to a community site is the nodeSearch method of the Node object (also accessed through the standard search page). This performs a full-text, indexed hierarchical search of the entire database or a selected part of the hierarchy. Search keywords are ORd by default, but exact-phrase, AND, and NOT’d searches are also allowed. Granularity (whether to include individual Message nodes in the result list, or to return the parent Discussion node only one time) and various other parameters can be set. By default, results are returned in order of descending relevance, and the user’s access privileges are automatically applied.
nodeSearch returns a 2-element array: array[0] is a blank-delimited list of storedUniqueIds that match the search spec, and array[1] is the total number of matches. This is important because, by default, nodeSearch only returns a small number of the total results. That number, as well as a skip index, are parameters. This is because nodeSearch is really designed to return a paginated result set. Result sets can be made arbitrarily large, but there is a performance penalty.
Arbitrary text or values can also be appended to any database node and indexed, using Node.nodeSearchExtra. You could, for example, add the author’s city of residence to make postings from a given city easily searchable.
Webcrossing also implements a tagging engine. Any database node can be tagged with name:value pairs, and the Tags object gives you amazing flexibility and power in retrieving tagged items. For maximum performance, the entire tags index is retained in memory; tag searches are blazingly fast. The drawback to the tagging engine is that you do need some scripting skills to use it; there is not yet any default user interface written.
I'll write more about the tagging engine in a future post, but if you want to learn more about it now you can read more detailed documentation (pdf).
No comments:
Post a Comment