From 3a615a875b7de7903a26d1a120f2315ae8e1f877 Mon Sep 17 00:00:00 2001 From: CF Mitrah Date: Tue, 3 Apr 2018 17:26:39 +0530 Subject: [PATCH] Added collection, index, search component --- build.xml | 8 +++ source/components/Collection.cfc | 120 +++++++++++++++++++++++++++++++ source/components/Index.cfc | 89 +++++++++++++++++++++++ source/components/Search.cfc | 31 ++++++++ 4 files changed, 248 insertions(+) create mode 100644 source/components/Collection.cfc create mode 100644 source/components/Index.cfc create mode 100644 source/components/Search.cfc diff --git a/build.xml b/build.xml index 9880319..5e52777 100644 --- a/build.xml +++ b/build.xml @@ -10,6 +10,7 @@ + @@ -134,11 +135,18 @@ search: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bu + + + + + + + diff --git a/source/components/Collection.cfc b/source/components/Collection.cfc new file mode 100644 index 0000000..27326dd --- /dev/null +++ b/source/components/Collection.cfc @@ -0,0 +1,120 @@ + + + variables.attributes = {}; + + /** + * @hint Constructor + */ + public function init(){ + setAttributes(argumentCollection=arguments); + return this; + } + + /* + registers the collection with lucee. + */ + public void function create(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "create"; + return invokeTag(); + } + + /* + repair + */ + + public void function repair(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "repair"; + return invokeTag(); + } + + /* + unregisters a collection and deletes its directories. + */ + + public void function delete(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "delete"; + return invokeTag(); + } + + /* + optimizes the structure and contents of the collection for searching; recovers space. Causes collection to be taken offline, preventing searches and indexing. + */ + + public void function optimize(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "optimize"; + return invokeTag(); + } + + /* + Returns a query result set, named from the name attribute value, of the attributes of the collections that are registered by lucee. + */ + + public query function list(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "list"; + return invokeTag(); + } + + /* + creates a map to a collection. + */ + + public void function map(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "map"; + return invokeTag(); + } + + /* + Retrieves categories from the collection and indicates how many documents are in each one. Returns a structure of structures in which the category representing each substructure is associated with a number of documents + */ + + public Struct function categorylist(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "categorylist"; + return invokeTag(); + } + + public function setAttributes() { + StructAppend(variables.attributes, arguments, true); + return this; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/components/Index.cfc b/source/components/Index.cfc new file mode 100644 index 0000000..681857f --- /dev/null +++ b/source/components/Index.cfc @@ -0,0 +1,89 @@ + + + + variables.attributes = {}; + /** + * @hint Constructor + */ + public function init(){ + setAttributes(argumentCollection=arguments); + return this; + } + + /* + updates a collection and adds key to the index + */ + public void function update(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "update"; + return invokeTag(); + } + + /* + deletes all of the documents in a collection.Causes the collection to be taken offline, preventing searches. + */ + + public void function purge(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "purge"; + return invokeTag(); + } + + /* + removes collection documents as specified by the key attribute. + */ + + public void function delete(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "delete"; + return invokeTag(); + } + + /* + deletes all of the documents in a collection, and then performs an update + */ + + public void function refresh(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "refresh"; + return invokeTag(); + } + + /* + Returns a query result set, of indexed data . + */ + + public query function list(){ + this.setAttributes(argumentCollection=arguments); + variables.attributes.action = "list"; + return invokeTag(); + } + + public function setAttributes() { + StructAppend(variables.attributes, arguments, true); + return this; + } + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/components/Search.cfc b/source/components/Search.cfc new file mode 100644 index 0000000..25991af --- /dev/null +++ b/source/components/Search.cfc @@ -0,0 +1,31 @@ + + + variables.attributes = {}; + /** + * @hint Constructor + */ + public function init(){ + setAttributes(argumentCollection=arguments); + return this; + } + + /* + Executes searches against data indexed + */ + public Query function search(){ + this.setAttributes(argumentCollection=arguments); + return invokeTag(); + } + + public function setAttributes() { + StructAppend(variables.attributes, arguments, true); + return this; + } + + + + + + + +