| 43 |
43 |
import org.txm.index.core.messages.IndexCoreMessages;
|
| 44 |
44 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
|
| 45 |
45 |
import org.txm.searchengine.cqp.corpus.CQPCorpus;
|
| 46 |
|
import org.txm.searchengine.cqp.corpus.CQPLexicon;
|
| 47 |
46 |
import org.txm.searchengine.cqp.corpus.Part;
|
| 48 |
47 |
import org.txm.searchengine.cqp.corpus.Partition;
|
| 49 |
48 |
import org.txm.searchengine.cqp.corpus.Property;
|
| ... | ... | |
| 61 |
60 |
*/
|
| 62 |
61 |
public class PartitionIndex extends Index {
|
| 63 |
62 |
|
| 64 |
|
/** The lexicon used to compute the index (if query = null || query == [] && properties.size() == 1 */
|
| 65 |
|
@Deprecated
|
| 66 |
|
protected CQPLexicon lexicon;
|
| 67 |
|
|
| 68 |
63 |
/**
|
| 69 |
64 |
*
|
| 70 |
65 |
* @param parent
|
| ... | ... | |
| 213 |
208 |
|
| 214 |
209 |
@Override
|
| 215 |
210 |
public String getDetails() {
|
| 216 |
|
if (lexicon != null) {
|
| 217 |
|
return lexicon.getDetails();
|
| 218 |
|
}
|
| 219 |
|
else {
|
| 220 |
|
|
| 221 |
|
try {
|
| 222 |
|
Object[] params = new Object[] { this.parent.getSimpleName(), this.getQuery().getQueryString(), this.getProperties(), this.getFmin(), this.getFmax() };
|
| 223 |
|
String str;
|
| 224 |
|
if (this.parent instanceof Partition) {
|
| 225 |
|
str = IndexCoreMessages.indexColonPartitionP0queryP1propertiesP2FminP3FmaxP4;
|
| 226 |
|
}
|
| 227 |
|
else {
|
| 228 |
|
str = IndexCoreMessages.indexColonCorpusP0queryP1propertiesP2FminP3FmaxP4;
|
| 229 |
|
}
|
| 230 |
|
return NLS.bind(str, params);
|
|
211 |
try {
|
|
212 |
Object[] params = new Object[] { this.parent.getSimpleName(), this.getQuery().getQueryString(), this.getProperties(), this.getFmin(), this.getFmax() };
|
|
213 |
String str;
|
|
214 |
if (this.parent instanceof Partition) {
|
|
215 |
str = IndexCoreMessages.indexColonPartitionP0queryP1propertiesP2FminP3FmaxP4;
|
| 231 |
216 |
}
|
| 232 |
|
catch (Exception e) {
|
| 233 |
|
return getName();
|
|
217 |
else {
|
|
218 |
str = IndexCoreMessages.indexColonCorpusP0queryP1propertiesP2FminP3FmaxP4;
|
| 234 |
219 |
}
|
|
220 |
return NLS.bind(str, params);
|
| 235 |
221 |
}
|
|
222 |
catch (Exception e) {
|
|
223 |
return getName();
|
|
224 |
}
|
| 236 |
225 |
}
|
| 237 |
226 |
|
| 238 |
227 |
|
| 239 |
|
|
| 240 |
228 |
/**
|
| 241 |
|
* If the index has been build with corpus + property, the method returns the lexicon used.
|
| 242 |
|
*
|
| 243 |
|
* @return the lexicon
|
| 244 |
|
*/
|
| 245 |
|
public CQPLexicon getLexicon() {
|
| 246 |
|
return lexicon;
|
| 247 |
|
}
|
| 248 |
|
|
| 249 |
|
/**
|
| 250 |
229 |
* update the lines counts.
|
| 251 |
230 |
*/
|
| 252 |
231 |
@Override
|
| ... | ... | |
| 272 |
251 |
@Override
|
| 273 |
252 |
public String getName() {
|
| 274 |
253 |
try {
|
| 275 |
|
if (lexicon != null) {
|
| 276 |
|
return lexicon.getName();
|
| 277 |
|
}
|
| 278 |
|
else {
|
| 279 |
|
return IndexCoreMessages.PARTITION_RESULT_TYPE + ": " + this.parent.getSimpleName() + ": " + this.getSimpleName();
|
| 280 |
|
}
|
|
254 |
return IndexCoreMessages.PARTITION_RESULT_TYPE + ": " + this.parent.getSimpleName() + ": " + this.getSimpleName();
|
| 281 |
255 |
}
|
| 282 |
256 |
catch (Exception e) {
|
| 283 |
257 |
return this.getEmptyName();
|
| ... | ... | |
| 324 |
298 |
|
| 325 |
299 |
@Override
|
| 326 |
300 |
public String getSimpleName() {
|
| 327 |
|
if (lexicon != null) {
|
| 328 |
|
return lexicon.getSimpleName();
|
| 329 |
|
}
|
| 330 |
|
else {
|
| 331 |
|
String name = ""; //$NON-NLS-1$
|
| 332 |
|
if (pQuery != null && !pQuery.isEmpty()) {
|
| 333 |
|
name += pQuery.getQueryString();
|
| 334 |
|
name += ": "; //$NON-NLS-1$
|
| 335 |
|
|
| 336 |
|
for (Property s : pProperties) {
|
| 337 |
|
name += s.getName() + pPropertiesSeparator;
|
| 338 |
|
}
|
| 339 |
|
if (pProperties.size() > 0) {
|
| 340 |
|
name = name.substring(0, name.length() - 1);
|
| 341 |
|
}
|
| 342 |
|
return name;
|
|
301 |
String name = ""; //$NON-NLS-1$
|
|
302 |
if (pQuery != null && !pQuery.isEmpty()) {
|
|
303 |
name += pQuery.getQueryString();
|
|
304 |
name += ": "; //$NON-NLS-1$
|
|
305 |
|
|
306 |
for (Property s : pProperties) {
|
|
307 |
name += s.getName() + pPropertiesSeparator;
|
| 343 |
308 |
}
|
| 344 |
|
else {
|
| 345 |
|
return this.getEmptyName();
|
|
309 |
if (pProperties.size() > 0) {
|
|
310 |
name = name.substring(0, name.length() - 1);
|
| 346 |
311 |
}
|
|
312 |
return name;
|
| 347 |
313 |
}
|
|
314 |
else {
|
|
315 |
return this.getEmptyName();
|
|
316 |
}
|
| 348 |
317 |
}
|
| 349 |
318 |
|
| 350 |
319 |
|
| ... | ... | |
| 369 |
338 |
public void setParameters(List<WordProperty> props) {
|
| 370 |
339 |
this.pQuery = new CQLQuery("[]"); //$NON-NLS-1$
|
| 371 |
340 |
this.pProperties = props;
|
| 372 |
|
this.lexicon = null;
|
| 373 |
341 |
}
|
| 374 |
342 |
|
| 375 |
343 |
|
| 376 |
344 |
|
| 377 |
|
|
| 378 |
|
|
| 379 |
|
|
| 380 |
|
|
| 381 |
345 |
/**
|
| 382 |
346 |
* dump a part of the index.
|
| 383 |
347 |
*
|