Revision 2103

tmp/org.txm.core/src/java/org/txm/objects/Match.java (revision 2103)
59 59
	public abstract void setStart(int p);
60 60
	
61 61
	public abstract void setTarget(int p);
62
	
63
	/**
64
	 * intersect sorted list of Matches
65
	 * @param list1
66
	 * @param sublist2
67
	 * @param strict_inclusion if true the match must be exactly included
68
	 * @return the matches of sublist2 included in the matches of list1
69
	 */
70
	public static List<Match> intersect(List<? extends Match> list1, List<? extends Match> sublist2, boolean strict_inclusion) {
71
		ArrayList<Match> result = new ArrayList<>();
72
		int i1 = 0;
73
		int i2 = 0;
74
		for (; i2 < sublist2.size() && i1 < list1.size(); ) {
75
			Match m = list1.get(i1);
76
			Match subm = sublist2.get(i2);
77
			if (m.getEnd() < subm.getStart()) {
78
				i1++;
79
			} else if (subm.getEnd() < m.getStart()) {
80
				i2++;
81
			} else {
82
				if (strict_inclusion) {
83
					if (m.getStart() <= subm.getStart() && subm.getEnd() <= m.getEnd()) {
84
						result.add(subm);
85
					}
86
				} else {
87
					result.add(subm);
88
				}
89

  
90
				i2++;
91
			}
92
		}
93
		
94
		return result;
95
	}
62 96
}
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSelection.java (revision 2103)
9 9

  
10 10
public class TIGERSelection extends Selection {
11 11

  
12
	ArrayList<TIGERMatch> matches;
12
	List<? extends Match> matches;
13 13
	Query query;
14 14
	
15
	public TIGERSelection(Query query, ArrayList<TIGERMatch> matches2) {
15
	public TIGERSelection(Query query, List<? extends Match> result2) {
16 16
		this.query = query;
17
		matches = matches2;
17
		matches = result2;
18 18
	}
19 19
	
20 20
	@Override
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 2103)
55 55
		File configfile = new File(tigerDirectory, "tigersearch.logprop");
56 56
		TSCorpusManager manager = new TSCorpusManager(tigerDirectory, configfile);
57 57

  
58
		TSCorpus tcorpus = manager.getCorpus(corpus.getID());
58
		
59
		TSCorpus tcorpus = manager.getCorpus(corpus.getRootCorpusBuild().getID());
59 60
		TSResult result = tcorpus.query(query.getQueryString());
60 61
		MatchResult mresult = result.getMatchResult();
61 62
		int size = mresult.size();
......
117 118
			}
118 119
		}
119 120

  
120
		return new TIGERSelection(query, new ArrayList<TIGERMatch>(tigerMatchesList));
121
		//intersect with corpus matches
122
		List<? extends Match> result2 = Match.intersect(corpus.getMatches(),  new ArrayList<TIGERMatch>(tigerMatchesList), true);
123
		
124
		return new TIGERSelection(query, result2);
121 125
	}
122 126

  
123 127
	@Override
tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 2103)
42 42
		
43 43
		this.corpus = getParent();
44 44

  
45
		String id = corpus.getName();
45
		String id = corpus.getRootCorpusBuild().getName();
46 46
		File configfile = new File(corpus.getProjectDirectory(),"tiger/tigersearch.logprop");
47 47
		File registrydir = new File(corpus.getProjectDirectory(), "tiger");
48 48
		File tscorpusdir = new File(corpus.getProjectDirectory(), "tiger/"+id);
tmp/org.txm.analec.rcp/src/org/txm/macro/urs/AnalecUtils.groovy (revision 2103)
282 282
		if (debug >= 3) println ""+unit.getDeb()+"->"+unit.getFin()+"	"+match.getStart()+"->"+match.getEnd()
283 283
		if (unit.getFin() < match.getStart()) {
284 284
			if (debug >= 3) "println next unit"
285
				iCurrentUnit++
285
			
286
			iCurrentUnit++
286 287
		} else if (unit.getDeb() > match.getEnd()) {
287 288
			if (debug >= 3) "println next match"
288
				iCurrentMatch++
289
			
290
			iCurrentMatch++
289 291
			selectedUnits = []
290 292
			selectedUnitsPerMatch[iCurrentMatch] = selectedUnits
291 293
		} else {

Also available in: Unified diff