helma/modules/jala/docs/jala.IndexManager.html

616 lines
18 KiB
HTML
Raw Normal View History

2020-03-16 16:53:52 +01:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
jala.IndexManager
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="jala.IndexManager";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary-IndexManager.js.html"><FONT CLASS="NavBarFont1"><B>File</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev">&nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<!--TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"--> <!--A HREF="deprecated-list.html"--><!--FONT CLASS="NavBarFont1">Deprecated</FONT--><!--/A--><!--&nbsp;</TD-->
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"--><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<B>Jala 1.3</B>
</EM>
</TD
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="jala.ImageFilter.html"><B>PREV CLASS</B></A><!--
NEXT CLASS
-->
&nbsp;<A HREF="jala.IndexManager.Job.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="jala.IndexManager.html" TARGET="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;
<SCRIPT>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>Class jala.IndexManager</H2>
<PRE>Object
|
+--<b>jala.IndexManager</b>
</PRE>
<HR>
<DL>
<!-- Class definition -->
<DT>class
<B>jala.IndexManager</B>
</DL>
<P>
<BR/>This class basically sits on top of a helma.Search.Index instance
and provides methods for adding, removing and optimizing the underlying index.
All methods generate jobs that are put into an internal queue which is
processed asynchronously by a separate worker thread. This means all calls
to add(), remove() and optimize() will return immediately, but the changes to
the index will be done within a short delay. Please keep in mind to change the
status of this IndexManager instance to REBUILDING before starting to rebuild
the index, as this ensures that all add/remove/optimize jobs will stay in the
queue and will only be processed after switching the status back to NORMAL.
This ensures that objects that have been modified during a rebuilding process
are re-indexed properly afterwards.
<BR/><I>Defined in <a href='overview-summary-IndexManager.js.html'>IndexManager.js</a></I><BR/><BR/><B>See:</B><UL>- helma.Search.createIndex</UL>
</P>
<HR>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="inner_classes"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&lt;static&nbsp;class&gt;</CODE></FONT></TD>
<TD><CODE><B><A HREF="jala.IndexManager.Job.html">jala.IndexManager.Job</A></B></CODE></TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== END NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<!-- This is one instance field summary -->
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&lt;static&gt; &nbsp;&lt;final&gt;&nbsp;Number</CODE></FONT></TD>
<TD><CODE><B><A HREF="#!s!MAXTRIES">MAXTRIES</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constant defining the maximum number of tries to add/remove
an object to/from the underlying index.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&lt;static&gt; &nbsp;&lt;final&gt;&nbsp;Number</CODE></FONT></TD>
<TD><CODE><B><A HREF="#!s!NORMAL">NORMAL</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constant defining normal mode of this index manager.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&lt;static&gt; &nbsp;&lt;final&gt;&nbsp;Number</CODE></FONT></TD>
<TD><CODE><B><A HREF="#!s!REBUILDING">REBUILDING</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constant defining rebuilding mode of this index manager.</TD>
</TR>
</TABLE>
&nbsp;
<!-- =========== END FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD>
<CODE>
<B>
<A HREF="jala.IndexManager.html#jala.IndexManager()">jala.IndexManager</A>
</B>
(&lt;String&gt; name, &lt;helma.File&gt; dir, &lt;String&gt; lang)
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Constructs a new IndexManager object.
</TD>
</TR>
</TABLE>
<!-- ======== END CONSTRUCTOR SUMMARY ======== -->
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%">
<FONT SIZE="-1">
<CODE>&nbsp;Boolean</CODE>
</FONT>
</TD>
<TD>
<CODE>
<B>
<A HREF="#add">add</A></B>(&lt;helma.Search.Document&gt; doc)
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Queues the document object passed as argument for addition to the underlying
index.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%">
<FONT SIZE="-1">
<CODE>&nbsp;void</CODE>
</FONT>
</TD>
<TD>
<CODE>
<B>
<A HREF="#log">log</A></B>()
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Helper function that prefixes every log message with
the name of the IndexManager.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%">
<FONT SIZE="-1">
<CODE>&nbsp;Boolean</CODE>
</FONT>
</TD>
<TD>
<CODE>
<B>
<A HREF="#optimize">optimize</A></B>()
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Queues the optimization of the underlying index.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%">
<FONT SIZE="-1">
<CODE>&nbsp;Boolean</CODE>
</FONT>
</TD>
<TD>
<CODE>
<B>
<A HREF="#remove">remove</A></B>(&lt;Number&gt; id)
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Queues the removal of all index documents whose identifier value ("id" by default)
matches the number passed as argument.
</TD>
</TR>
</TABLE>
<P>
<!-- ========== END METHOD SUMMARY =========== -->
<!-- ============ FIELD DETAIL START =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="!s!MAXTRIES"><!-- --></A>
<H3>MAXTRIES</H3>
<PRE>&lt;static&gt;&nbsp;&lt;final&gt;&nbsp;Number&nbsp;<B>MAXTRIES</B></PRE>
<UL>
Constant defining the maximum number of tries to add/remove
an object to/from the underlying index.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="constant-values.html#java.awt.AWTEvent.COMPONENT_EVENT_MASK">Constant Field Values</A></DL>
</DL>
</UL>
<HR>
<A NAME="!s!NORMAL"><!-- --></A>
<H3>NORMAL</H3>
<PRE>&lt;static&gt;&nbsp;&lt;final&gt;&nbsp;Number&nbsp;<B>NORMAL</B></PRE>
<UL>
Constant defining normal mode of this index manager.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="constant-values.html#java.awt.AWTEvent.COMPONENT_EVENT_MASK">Constant Field Values</A></DL>
</DL>
</UL>
<HR>
<A NAME="!s!REBUILDING"><!-- --></A>
<H3>REBUILDING</H3>
<PRE>&lt;static&gt;&nbsp;&lt;final&gt;&nbsp;Number&nbsp;<B>REBUILDING</B></PRE>
<UL>
Constant defining rebuilding mode of this index manager.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="constant-values.html#java.awt.AWTEvent.COMPONENT_EVENT_MASK">Constant Field Values</A></DL>
</DL>
</UL>
<HR>
<!-- ============ FIELD DETAIL END =========== -->
<!-- ========= CONSTRUCTOR DETAIL START ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1>
<FONT SIZE="+2"><B>Constructor Detail</B></FONT>
</TD>
</TR>
</TABLE>
<A NAME="jala.IndexManager()"><!-- --></A><H3>
jala.IndexManager</H3>
<PRE><B>jala.IndexManager</B>(&lt;String&gt; name, &lt;helma.File&gt; dir, &lt;String&gt; lang)</PRE>
<UL>
Constructs a new IndexManager object.
</UL>
<UL>
<B>Parameters:</B>
<UL><CODE>name</CODE> - The name of the index, which is the name of the directory the index already resides or will be created in.
</UL>
<UL><CODE>dir</CODE> - The base directory where this index's directory is already existing or will be created in.
</UL>
<UL><CODE>lang</CODE> - The language of the documents in this index. This leads to the proper Lucene analyzer being used for indexing documents.
</UL>
</UL>
<!-- Constructor return value(s) -->
<!-- End constructor return value(s) -->
<!-- ADDITIONAL ATTRIBUTES -->
<UL>
<B>See:</B><UL>- helma.Search.createIndex</UL>
</UL>
<HR/>
<!-- END ADDITIONAL ATTRIBUTES -->
<!-- ========= CONSTRUCTOR DETAIL END ======== -->
<!-- ============ METHOD DETAIL START ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT>
</TD>
</TR>
</TABLE>
<!-- One single method detail entry -->
<A NAME="add"><!-- --></A>
<H3>add</H3>
<PRE>Boolean <B>add</B>(&lt;helma.Search.Document&gt; doc)</PRE>
<UL>Queues the document object passed as argument for addition to the underlying
index. This includes that all existing documents with the same identifier will
be removed before the object passed as argument is added.</UL>
<!-- METHOD PARAMETERS START -->
<UL>
<B>Parameters:</B>
<UL><CODE>doc</CODE> - The document object that should be added to the underlying index.
</UL>
</UL>
<!-- METHOD PARAMETERS END -->
<UL>
<B>Returns:</B>
<UL>
True if the job was added successfully to the internal queue, false otherwise.
</UL>
</UL>
<!-- ADDITIONAL ATTRIBUTES START -->
<UL>
<B>See:</B><UL>- helma.Search.Document</UL>
</UL>
<!-- ADDITIONAL ATTRIBUTES END -->
<HR>
<A NAME="log"><!-- --></A>
<H3>log</H3>
<PRE>void <B>log</B>()</PRE>
<UL>Helper function that prefixes every log message with
the name of the IndexManager.</UL>
<!-- METHOD PARAMETERS START -->
<UL>
<B>Parameters:</B>
<UL><CODE>level</CODE> - An optional logging level. Accepted values
</UL>
<UL><CODE>msg</CODE> - The log message are "debug", "info", "warn" and "error".
</UL>
</UL>
<!-- METHOD PARAMETERS END -->
<!-- ADDITIONAL ATTRIBUTES START -->
<!-- ADDITIONAL ATTRIBUTES END -->
<HR>
<A NAME="optimize"><!-- --></A>
<H3>optimize</H3>
<PRE>Boolean <B>optimize</B>()</PRE>
<UL>Queues the optimization of the underlying index.</UL>
<!-- METHOD PARAMETERS START -->
<!-- METHOD PARAMETERS END -->
<UL>
<B>Returns:</B>
<UL>
True if the optimizing job was added, false otherwise, which means that there is already an optimizing job waiting in the queue.
</UL>
</UL>
<!-- ADDITIONAL ATTRIBUTES START -->
<!-- ADDITIONAL ATTRIBUTES END -->
<HR>
<A NAME="remove"><!-- --></A>
<H3>remove</H3>
<PRE>Boolean <B>remove</B>(&lt;Number&gt; id)</PRE>
<UL>Queues the removal of all index documents whose identifier value ("id" by default)
matches the number passed as argument.</UL>
<!-- METHOD PARAMETERS START -->
<UL>
<B>Parameters:</B>
<UL><CODE>id</CODE> - The identifier value
</UL>
</UL>
<!-- METHOD PARAMETERS END -->
<UL>
<B>Returns:</B>
<UL>
True if the removal job was added successfully to the queue, false otherwise.
</UL>
</UL>
<!-- ADDITIONAL ATTRIBUTES START -->
<!-- ADDITIONAL ATTRIBUTES END -->
<HR>
<!-- ============ METHOD DETAIL END ========== -->
<!-- ========= END OF CLASS DATA ========= -->
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary-IndexManager.js.html"><FONT CLASS="NavBarFont1"><B>File</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><b>Tree</b></FONT></A>&nbsp;</TD>
<!--TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"--> <!--A HREF="deprecated-list.html"--><!--FONT CLASS="NavBarFont1">Deprecated</FONT--><!--/A--><!--&nbsp;</TD-->
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<B>Jala 1.3</B>
</EM>
</TD
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="jala.ImageFilter.html"><B>PREV CLASS</B></A><!--
NEXT CLASS
-->
&nbsp;<A HREF="jala.IndexManager.Job.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="jala.IndexManager.html" TARGET="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;
<SCRIPT>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<FONT SIZE="-1">
</FONT>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Tue Jan 8 15:45:31 2008</div>
</BODY>
</HTML>