Revision: 16065 http://gate.svn.sourceforge.net/gate/?rev=16065&view=rev Author: valyt Date: 2012-09-11 11:47:09 +0000 (Tue, 11 Sep 2012) Log Message: ----------- Keep the term value even if the termID is known. The actual term string is used by the scorers, which cause an NPE if the term is not available.
Modified Paths: -------------- mimir/trunk/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java mimir/trunk/mimir-core/src/gate/mimir/search/query/TermQuery.java Modified: mimir/trunk/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java =================================================================== --- mimir/trunk/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java 2012-09-11 10:53:45 UTC (rev 16064) +++ mimir/trunk/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java 2012-09-11 11:47:09 UTC (rev 16065) @@ -88,7 +88,8 @@ for(int index = 0; index < trs.termStrings.length; index++) { // create a term query for the mention URI disjuncts[index] = new TermQuery(query.annotationType, - trs.termIds[index], trs.termLengths[index]); + trs.termStrings[index], trs.termIds[index], + trs.termLengths[index]); } QueryNode underlyingQuery = new OrQuery(disjuncts); underlyingExecutor = underlyingQuery.getQueryExecutor(engine); Modified: mimir/trunk/mimir-core/src/gate/mimir/search/query/TermQuery.java =================================================================== --- mimir/trunk/mimir-core/src/gate/mimir/search/query/TermQuery.java 2012-09-11 10:53:45 UTC (rev 16064) +++ mimir/trunk/mimir-core/src/gate/mimir/search/query/TermQuery.java 2012-09-11 11:47:09 UTC (rev 16065) @@ -119,6 +119,10 @@ // if we have the term ID, use that if(query.termId != DocumentIterator.END_OF_LIST) { this.indexIterator = indexReader.documents(query.termId); + // set the term (used by rankers) + MutableString mutableString = new MutableString(query.getTerm()); + indexReaderPool.getIndex().termProcessor.processTerm(mutableString); + this.indexIterator.term(mutableString); } else { //use the term processor for the query term MutableString mutableString = new MutableString(query.getTerm()); @@ -368,8 +372,8 @@ * * @see IndexConfig.TokenIndexerConfig */ - public TermQuery(String indexName, long termId) { - this(IndexType.TOKENS, indexName, termId, 1); + public TermQuery(String indexName, String term, long termId) { + this(IndexType.TOKENS, indexName, term, termId, 1); } /** @@ -398,8 +402,8 @@ * * @param length the length of the mention sought. */ - public TermQuery(String annotationType, long mentionTermid, int length) { - this(IndexType.ANNOTATIONS, annotationType, mentionTermid, length); + public TermQuery(String annotationType, String term, long mentionTermid, int length) { + this(IndexType.ANNOTATIONS, annotationType, term, mentionTermid, length); } /** @@ -443,10 +447,11 @@ * * @param termId the term ID for sought term. */ - public TermQuery(IndexType indexType, String indexName, long termId, int length) { + public TermQuery(IndexType indexType, String indexName, String term, long termId, int length) { this.indexType = indexType; this.indexName = indexName; this.termId = termId; + this.term = term; this.length = length; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ GATE-cvs mailing list GATE-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gate-cvs