Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<property name="lib" location="source/java/libs"/>
<property name="src" location="source/java/src"/>
<property name="srcImg" location="source/images"/>
<property name="srcComp" location="source/components"/>
<property name="temp" location="temp"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
Expand Down Expand Up @@ -134,11 +135,18 @@ search: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bu
</fileset>
</copy>

<copy todir="${dist}/CFML/components">
<fileset dir="${srcComp}">
<include name="**/*.*"/>
</fileset>
</copy>



<!-- Zip everything -->
<zip destfile="${dist}/lucene-search-${bundleversion}${build.number}${appendix}.lex">
<zipfileset dir="${dist}/extension"/>
<zipfileset dir="${dist}/CFML"/>
</zip>

</target>
Expand Down
120 changes: 120 additions & 0 deletions source/components/Collection.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<cfcomponent accessors="true">
<cfscript>
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;
}

</cfscript>

<cffunction name="invokeTag" output="true" access="private" returntype="any" hint="invokes the service tag">
<cfset tagAttributes = variables.attributes>
<cfif tagAttributes.action eq 'list' || tagAttributes.action eq 'categorylist'>
<cfset tagAttributes.name = 'name'>
</cfif>

<!--- the xmlvar is forced for both actions --->
<cfset tagAttributes.xmlvar = 'xmlvar'>

<cfcollection attributeCollection="#tagAttributes#">

<cfswitch expression="#tagAttributes.action#">

<cfcase value="list">

<!--- <cfset result = {
name = name
}> --->
<cfreturn name>

</cfcase>

<cfcase value="categorylist">

<cfreturn name>
</cfcase>

</cfswitch>
<cfreturn "">
</cffunction>

</cfcomponent>
89 changes: 89 additions & 0 deletions source/components/Index.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<cfcomponent accessors="true" >

<cfscript>
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;
}
</cfscript>

<cffunction name="invokeTag" output="true" access="private" returntype="any" hint="invokes the service tag">
<cfset tagAttributes = variables.attributes>
<cfif tagAttributes.action eq 'list'>
<cfset tagAttributes.name = 'name'>
</cfif>

<cfindex attributeCollection="#tagAttributes#">

<cfswitch expression="#tagAttributes.action#">

<cfcase value="list">

<!--- <cfset result = {
name = name
}> --->
<cfreturn name>
</cfcase>

</cfswitch>
<cfreturn "">
</cffunction>
</cfcomponent>
31 changes: 31 additions & 0 deletions source/components/Search.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<cfcomponent accessors="true">
<cfscript>
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;
}
</cfscript>
<cffunction name="invokeTag" output="true" access="private" returntype="any" hint="invokes the service tag">
<cfset tagAttributes = variables.attributes>
<cfset tagAttributes.name = 'name'>
<cfsearch attributeCollection="#tagAttributes#">
<cfreturn name>
</cffunction>
</cfcomponent>