KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > search > JahiaIndexableDocument


1 package org.jahia.services.search;
2
3 import java.util.Hashtable JavaDoc;
4 //import org.apache.jetspeed.services.search.ParsedObject;
5

6 /**
7  * <p>Title: Interface for Fields (attritutes) that are stored </p>
8  * <p>Description: </p>
9  * <p>Copyright: Copyright (c) 2002</p>
10  * <p>Company: </p>
11  *
12  * @author Khue Nguyen
13  * @version 1.0
14  */

15 public interface JahiaIndexableDocument {
16
17     /**
18      * Return true if this object is to be added to search engine
19      *
20      * @return
21      */

22     public abstract boolean toBeAdded ();
23
24     /**
25      * Return true if this object is to be removed from search engine
26      *
27      * @return
28      */

29     public abstract boolean toBeRemoved ();
30
31     /**
32      * Set the state to be added / to be removed
33      *
34      * @return
35      */

36     public abstract void setBeAdded (boolean val);
37
38     /**
39      * The search engine will call this method before indexing this object,
40      * allowing custom processing.
41      * It will continue indexing only if the result of this method return true
42      *
43      * @return
44      */

45     public abstract boolean beforeAddingToSearchEngine ();
46
47     /**
48      * The search engine will call this method before removing from search engine,
49      * allowing custom processing.
50      * It will continue removing this object only if the result of this method return true
51      *
52      * @return
53      */

54     public abstract boolean beforeRemovingFromSearchEngine ();
55
56     /**
57      * return the site id
58      *
59      * @return
60      */

61     public abstract int getSiteId ();
62
63     /**
64      * Set the site id
65      *
66      * @param siteId
67      */

68     public abstract void setSiteId (int siteId);
69
70     /**
71      * return the unique key identifier
72      *
73      * @return
74      */

75     public abstract String JavaDoc getKey ();
76
77     /**
78      * Set the unique key identifier
79      *
80      * @param key
81      */

82     public abstract void setKey (String JavaDoc key);
83
84     /**
85      * Set the key field name.
86      * It is the field name under which the key value is stored ( when adding to
87      * the index ), and from which we look for when removing from search engine.
88      *
89      * @param key
90      */

91     public abstract void setKeyFieldName (String JavaDoc keyFieldName);
92
93     /**
94      * Return the key field name.
95      *
96      * @param key
97      */

98     public abstract String JavaDoc getKeyFieldName ();
99
100     /**
101      * Return an hastable of key/values to store as fields for this object
102      * the key is a String and the values is an array of string values
103      *
104      * @return
105      */

106     public abstract Hashtable JavaDoc getFields ();
107
108     /**
109      * Add a single value field
110      *
111      * @param key
112      * @param vals
113      */

114     public abstract void setField (String JavaDoc key, String JavaDoc val);
115
116     /**
117      * Add a multi-values field
118      *
119      * @param key
120      * @param vals
121      */

122     public abstract void setField (String JavaDoc key, String JavaDoc[] vals);
123
124     /**
125      * Remove a field
126      */

127     public abstract void removeField (String JavaDoc key);
128
129     /**
130      * Define which field's value can be stored in the index
131      * Only small value should be stored in the index.
132      * On the other hand a whole file content should not.
133      * By default, field's value are stored in the index file.
134      * If you want to not store an field's value ( i.e a whole file content )
135      * Set this field to unstore
136      *
137      * @param key , the field key
138      * @param store, should the value stored in the index or not
139      */

140     public abstract void unStoreField (String JavaDoc key);
141
142     /**
143      * Return true if the given field's value will be stored in the index file
144      * or not
145      *
146      * @param key, the field key
147      *
148      * @return
149      */

150     public abstract boolean isFieldUnStored (String JavaDoc key);
151
152     /**
153      * If this document can be scheduled ( indexation can be delayed, i.e in case of File Field Document which can take a lot
154      * of time when parsing pdf file ), it should return true and add itself in the indexationJob
155      *
156      * @param indexationJobDetail
157      * @return
158      */

159     public abstract boolean scheduled(IndexationJobDetail indexationJobDetail);
160
161
162     /**
163      * This method is called when the document add itself in the ScheduledIndexationJob's vector of schedulable documents
164      *
165      */

166     public abstract void doScheduledLoad();
167
168
169     /**
170      * Return true if this document is allowed to be indexed by RAMIndexer
171      *
172      * @return
173      */

174     public boolean isCacheableWithRAMIndexer();
175 }
176
Popular Tags