Révision 3162

tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java (revision 3162)
61 61
	
62 62
	/** The Constant ElectricStrategy. */
63 63
	private static final Integer ElectricStrategy = 3;
64

  
65
	public static final int MAX_CQL_LENGTH = 16000; // current CQL length limit is set to ~16000. The corpus name will affect the query limit length
64 66
	
65 67
	
66 68
	/** espace char |"{()}+*. */
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 3162)
126 126
		if (this.pQuery != null) {
127 127
			this.qresult = null; // reset
128 128
			String parent_id = this.getCorpusParent().getQualifiedCqpId();
129
			if (pQuery.getQueryString().length() > CQLQuery.MAX_CQL_LENGTH) {
130
				Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with {1} length.", CQLQuery.MAX_CQL_LENGTH, pQuery.getQueryString().length())); 
131
				return false;
132
			}
129 133
			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(parent_id, this.pID, CQLQuery.fixQuery(this.pQuery.getQueryString()));
130 134
			
131 135
			this.qresult = new QueryResult(this.pID, this.getUserName(), this.getCorpusParent(), this.pQuery); // getCorpusParent().query(pQuery, this.pID, true);
......
176 180
				}
177 181
				catch (Exception ex) {
178 182
					Log.warning(this.pID + TXMCoreMessages.failedToRestoreSubcorpus + subcorpusElem.getAttribute("name")
179
							+ " : " + ex); //$NON-NLS-1$
183
					+ " : " + ex); //$NON-NLS-1$
180 184
				}
181 185
			}
182 186
			
......
279 283
			return 0;
280 284
		}
281 285
	}
282
		
286
	
283 287
	// protected void finalize() throws Throwable {
284 288
	// try {
285 289
	// //
......
407 411
	
408 412
	@Override
409 413
	public int[] getStartLimits(String sup) throws IOException,
410
			CqiServerError, InvalidCqpIdException, CqiClientException {
414
	CqiServerError, InvalidCqpIdException, CqiClientException {
411 415
		return this.getMainCorpus().getStartLimits(sup);
412 416
	}
413 417
	
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java (revision 3162)
424 424
	
425 425
	@Override
426 426
	public boolean isTargetUsed() throws UnexpectedAnswerException, IOException, CqiServerError {
427
		
427

  
428 428
		return CQPSearchEngine.getCqiClient().subCorpusHasField(this.getQualifiedCqpId(), ICqiClient.CQI_CONST_FIELD_TARGET);
429 429
	}
430 430
	
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPLexicon.java (revision 3162)
39 39
import java.util.Map;
40 40

  
41 41
import org.eclipse.core.runtime.IProgressMonitor;
42
import org.eclipse.osgi.util.NLS;
42 43
import org.txm.core.messages.TXMCoreMessages;
43 44
import org.txm.core.results.TXMParameters;
44 45
import org.txm.core.results.TXMResult;
45 46
import org.txm.searchengine.cqp.AbstractCqiClient;
46 47
import org.txm.searchengine.cqp.ICqiClient;
47 48
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
49
import org.txm.searchengine.cqp.corpus.query.CQLQuery;
48 50
import org.txm.searchengine.cqp.corpus.query.MatchUtils;
49 51
import org.txm.searchengine.cqp.serverException.CqiServerError;
50 52
import org.txm.utils.TXMProgressMonitor;
......
262 264
			try {
263 265
				// System.out.println("subcorpus: "+corpus.getQualifiedCqpId());
264 266
				// System.out.println("query subcorpus: "+qtmp);
265

  
267
				if (tmp.length() > CQLQuery.MAX_CQL_LENGTH) {
268
					Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with {1} length.", CQLQuery.MAX_CQL_LENGTH, tmp.length())); 
269
					return false;
270
				}
266 271
				cqi.cqpQuery(corpus.getQualifiedCqpId(), tmp, "[]"); //$NON-NLS-1$
267 272
				fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1(qtmp, 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName());
268 273
				// System.out.println("nb lines: "+fdist.length);
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java (revision 3162)
541 541
		
542 542
		long start = System.currentTimeMillis();
543 543
		try {
544
			if (query.getQueryString().length() > CQLQuery.MAX_CQL_LENGTH) {
545
				Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with the {1} length.", CQLQuery.MAX_CQL_LENGTH, query.getQueryString().length())); 
546
				return null;
547
			}
548
			
544 549
			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), subcorpusCqpId, CQLQuery.fixQuery(query.getQueryString()));
545 550
			// System.out.println("SUBCORPUS: "+subcorpusCqpId+"
546 551
			// q="+query.getQueryString());
......
1429 1434
		String queryResultId = queryResultNamePrefix + getNextQueryCounter();
1430 1435
		String fixedQuery = CQLQuery.fixQuery(query.getQueryString());
1431 1436
		
1437
		if (fixedQuery.length() > CQLQuery.MAX_CQL_LENGTH) {
1438
			try {
1439
				Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with {1} length.", CQLQuery.MAX_CQL_LENGTH, fixedQuery.length())); 
1440
				return new FakeQueryResult(queryResultName, this, query, new int[0], new int[0], new int[0]);
1441
			}
1442
			catch (InvalidCqpIdException e) {
1443
				// TODO Auto-generated catch block
1444
				e.printStackTrace();
1445
			}
1446
		}
1447
		
1432 1448
		Log.finest(NLS.bind(TXMCoreMessages.queryOnP0ColonP1InfP2, new String[] { this.getQualifiedCqpId(), queryResultId, fixedQuery })); // $NON-NLS-1$
1433 1449
		// long start = System.currentTimeMillis();
1434 1450
		try {
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 3162)
2 2

  
3 3
import java.io.File;
4 4
import java.io.IOException;
5
import java.util.HashMap;
6 5
import java.util.List;
7 6

  
8 7
import org.eclipse.core.runtime.IProgressMonitor;
......
20 19
import org.txm.searchengine.core.Selection;
21 20
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
22 21
import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
23
import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
24 22
import org.txm.searchengine.cqp.corpus.CQPCorpus;
25 23
import org.txm.searchengine.cqp.corpus.CorpusManager;
26
import org.txm.searchengine.cqp.corpus.MainCorpus;
27 24
import org.txm.searchengine.cqp.corpus.Property;
28 25
import org.txm.searchengine.cqp.corpus.WordProperty;
29 26
import org.txm.searchengine.cqp.corpus.query.CQLQuery;
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Substraction.java (revision 3162)
145 145
						
146 146
						if (subcorpus == null) {
147 147
							monitor.done();
148
							Log.info(TXMUIMessages.errorColonSubcorpusWasNotCreated);
148
							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
149 149
							return Status.CANCEL_STATUS;
150 150
						}
151 151
						
152 152
						if (subcorpus.getSize() == 0) {
153
							Log.info("The created subcorpus was empty");
153
							Log.warning("The created subcorpus was empty");
154 154
							return Status.CANCEL_STATUS;
155 155
						}
156 156
						
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeSubCorpus.java (revision 3162)
195 195
						
196 196
						if (subcorpus == null) {
197 197
							monitor.done();
198
							Log.severe(TXMUIMessages.errorColonSubcorpusWasNotCreated);
198
							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
199 199
							return Status.CANCEL_STATUS;
200 200
						}
201 201
						
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Intersection.java (revision 3162)
146 146
						
147 147
						if (subcorpus == null) {
148 148
							monitor.done();
149
							System.out.println(TXMUIMessages.errorColonSubcorpusWasNotCreated);
149
							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
150 150
							return Status.CANCEL_STATUS;
151 151
						}
152 152
						
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Union.java (revision 3162)
146 146
						
147 147
						if (subcorpus == null) {
148 148
							monitor.done();
149
							System.out.println(TXMUIMessages.errorColonSubcorpusWasNotCreated);
149
							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
150 150
							return Status.CANCEL_STATUS;
151 151
						}
152 152
						

Formats disponibles : Unified diff