Author: ssmiweve
Date: 2007-06-21 10:28:55 +0200 (Thu, 21 Jun 2007)
New Revision: 5373
Removed:
trunk/query-api/src/main/java/no/schibstedsok/searchportal/query/token/ReportingTokenEvaluator.java
Modified:
trunk/core-api/src/main/java/no/schibstedsok/searchportal/run/RunningQuery.java
trunk/core-api/src/main/java/no/schibstedsok/searchportal/run/RunningQueryImpl.java
trunk/query-api/src/main/java/no/schibstedsok/searchportal/query/token/VeryFastTokenEvaluator.java
Log:
SEARCH-943 - Remove ReportingTokenEvaluator
Modified:
trunk/core-api/src/main/java/no/schibstedsok/searchportal/run/RunningQuery.java
===================================================================
---
trunk/core-api/src/main/java/no/schibstedsok/searchportal/run/RunningQuery.java
2007-06-21 08:17:28 UTC (rev 5372)
+++
trunk/core-api/src/main/java/no/schibstedsok/searchportal/run/RunningQuery.java
2007-06-21 08:28:55 UTC (rev 5373)
@@ -38,9 +38,6 @@
/** TODO comment me. **/
List getEnrichments();
- /** TODO comment me. **/
- List getGeographicMatches();
-
/**
* First find out if the user types in an advanced search etc by analyzing
the queryStr.
* Then lookup correct tip using messageresources.
Modified:
trunk/core-api/src/main/java/no/schibstedsok/searchportal/run/RunningQueryImpl.java
===================================================================
---
trunk/core-api/src/main/java/no/schibstedsok/searchportal/run/RunningQueryImpl.java
2007-06-21 08:17:28 UTC (rev 5372)
+++
trunk/core-api/src/main/java/no/schibstedsok/searchportal/run/RunningQueryImpl.java
2007-06-21 08:28:55 UTC (rev 5373)
@@ -33,11 +33,8 @@
import no.schibstedsok.searchportal.query.analyser.AnalysisRule;
import no.schibstedsok.searchportal.query.analyser.AnalysisRuleFactory;
import no.schibstedsok.searchportal.query.QueryStringContext;
-import no.schibstedsok.searchportal.query.token.ReportingTokenEvaluator;
import no.schibstedsok.searchportal.query.token.TokenEvaluationEngine;
import no.schibstedsok.searchportal.query.token.TokenEvaluationEngineImpl;
-import no.schibstedsok.searchportal.query.token.TokenMatch;
-import no.schibstedsok.searchportal.query.token.TokenPredicate;
import no.schibstedsok.searchportal.mode.command.SearchCommand;
import no.schibstedsok.searchportal.mode.SearchCommandFactory;
import no.schibstedsok.searchportal.mode.config.SearchConfiguration;
@@ -47,7 +44,6 @@
import no.schibstedsok.searchportal.query.Query;
import no.schibstedsok.searchportal.query.parser.QueryParser;
import no.schibstedsok.searchportal.query.parser.QueryParserImpl;
-import no.schibstedsok.searchportal.query.token.VeryFastListQueryException;
import no.schibstedsok.searchportal.result.Enrichment;
import no.schibstedsok.searchportal.result.Modifier;
import no.schibstedsok.searchportal.result.NavigationItem;
@@ -189,27 +185,7 @@
// Public --------------------------------------------------------
-
/** [EMAIL PROTECTED] **/
- public List<TokenMatch> getGeographicMatches() {
-
-
- final List<TokenMatch> matches = new ArrayList<TokenMatch>();
-
- try{
-
- matches.addAll(getTokenMatches(TokenPredicate.GEOLOCAL));
- matches.addAll(getTokenMatches(TokenPredicate.GEOGLOBAL));
-
- }catch(VeryFastListQueryException ie){
- LOG.error("Magnus: fix SEARCH-943 :-)");
- }
- Collections.sort(matches);
-
- return matches;
- }
-
- /** [EMAIL PROTECTED] **/
public String getGlobalSearchTips () {
LOG.trace("getGlobalSearchTips()");
@@ -563,12 +539,6 @@
// Private -------------------------------------------------------
- private List<TokenMatch> getTokenMatches(final TokenPredicate token)
throws VeryFastListQueryException {
-
- final ReportingTokenEvaluator e = (ReportingTokenEvaluator)
engine.getEvaluator(token);
- return e.reportToken(token, datamodel.getQuery().getString());
- }
-
private void performHandlers(){
// TODO move into Run Handler SPI
Deleted:
trunk/query-api/src/main/java/no/schibstedsok/searchportal/query/token/ReportingTokenEvaluator.java
===================================================================
---
trunk/query-api/src/main/java/no/schibstedsok/searchportal/query/token/ReportingTokenEvaluator.java
2007-06-21 08:17:28 UTC (rev 5372)
+++
trunk/query-api/src/main/java/no/schibstedsok/searchportal/query/token/ReportingTokenEvaluator.java
2007-06-21 08:28:55 UTC (rev 5373)
@@ -1,22 +0,0 @@
-/*
- * Copyright (2005) Schibsted Søk AS
- */
-package no.schibstedsok.searchportal.query.token;
-
-import java.util.List;
-
-public interface ReportingTokenEvaluator {
- /**
- * Returns a list of all matches of type token. If the query for example is
- * "brødrene dahl oslo" and the token is "geo" reportToken could return
- * "dahl" and "oslo". If there are no matches, the empty list is returned.
- *
- * @param token
- * the token to look for.
- * @param query
- * the query to look in.
- * @return the matches.
- */
- List<TokenMatch> reportToken(TokenPredicate token, String query);
-
-}
Modified:
trunk/query-api/src/main/java/no/schibstedsok/searchportal/query/token/VeryFastTokenEvaluator.java
===================================================================
---
trunk/query-api/src/main/java/no/schibstedsok/searchportal/query/token/VeryFastTokenEvaluator.java
2007-06-21 08:17:28 UTC (rev 5372)
+++
trunk/query-api/src/main/java/no/schibstedsok/searchportal/query/token/VeryFastTokenEvaluator.java
2007-06-21 08:28:55 UTC (rev 5373)
@@ -45,12 +45,14 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Michael Semb Wever</a>
* @version $Id$
*/
-public final class VeryFastTokenEvaluator implements TokenEvaluator,
ReportingTokenEvaluator {
+public final class VeryFastTokenEvaluator implements TokenEvaluator {
/** The context required by this class. **/
public interface Context extends BaseContext, QueryStringContext,
DocumentContext, PropertiesContext, SiteContext{
}
+ // Constants -----------------------------------------------------
+
private static final Logger LOG =
Logger.getLogger(VeryFastTokenEvaluator.class);
private static final String ERR_FAILED_INITIALISATION = "Failed reading
configuration files";
private static final String ERR_QUERY_FAILED = "Querying the fast list
failed on ";
@@ -72,13 +74,18 @@
= new HashMap<Site,Map<TokenPredicate,String>>();
private static final ReentrantReadWriteLock LIST_NAMES_LOCK = new
ReentrantReadWriteLock();
+ // Attributes ----------------------------------------------------
+
private volatile boolean init = false;
private final HTTPClient httpClient;
private final Context context;
private final Map<String, List<TokenMatch>> analysisResult = new
HashMap<String,List<TokenMatch>>();
+ // Static --------------------------------------------------------
+ // Constructors -------------------------------------------------
+
/**
* Search fast and initialize analysis result.
* @param query
@@ -99,6 +106,75 @@
queryFast(context.getQueryString());
}
+ // Public --------------------------------------------------------
+
+ /**
+ * Find out if given token is on or more of the following.
+ * <li>GEO
+ * <li>FIRSTNAME
+ * <li>LASTNAME
+ * <li>COMPANY
+ * <li>KEYWORDS
+ * <li>CATEGORY
+ * </ul>
+ *
+ * @param token can be any of the above
+ * @return true if the query contains any of the above
+ */
+ public boolean evaluateToken(final TokenPredicate token, final String
term, final String query) {
+
+ boolean evaluation = false;
+ final String realTokenFQ = getFastListName(token);
+
+ if (analysisResult.containsKey(realTokenFQ)) {
+ if (term == null) {
+ evaluation = true;
+ } else {
+
+ // HACK since DefaultOperatorClause wraps its children in
parenthesis
+ final String hackTerm = term.replaceAll("\\(|\\)","");
+
+ for (TokenMatch occurance : analysisResult.get(realTokenFQ)) {
+
+ final Matcher m =occurance.getMatcher(hackTerm);
+ evaluation = m.find() && m.start() == 0 && m.end() ==
hackTerm.length();
+
+ // keep track of which TokenMatch's we've used.
+ if (evaluation) {
+ occurance.setTouched(true);
+ break;
+ }
+ }
+ }
+
+ }
+ return evaluation;
+ }
+
+ /** **/
+ public List<TokenMatch> reportToken(final TokenPredicate token, final
String query) {
+
+ LOG.trace("reportToken(" + token + "," + query + ")");
+
+ if (evaluateToken(token, null, query)) {
+ final String realTokenFQ = getFastListName(token);
+ return analysisResult.get(realTokenFQ);
+ } else {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ /** TODO comment me. **/
+ public boolean isQueryDependant(final TokenPredicate predicate) {
+ return predicate.name().startsWith(EXACT_PREFIX.toUpperCase());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
private void init() {
try{
@@ -188,62 +264,6 @@
}
/**
- * Find out if given token is on or more of the following.
- * <li>GEO
- * <li>FIRSTNAME
- * <li>LASTNAME
- * <li>COMPANY
- * <li>KEYWORDS
- * <li>CATEGORY
- * </ul>
- *
- * @param token can be any of the above
- * @return true if the query contains any of the above
- */
- public boolean evaluateToken(final TokenPredicate token, final String
term, final String query) {
-
- boolean evaluation = false;
- final String realTokenFQ = getFastListName(token);
-
- if (analysisResult.containsKey(realTokenFQ)) {
- if (term == null) {
- evaluation = true;
- } else {
-
- // HACK since DefaultOperatorClause wraps its children in
parenthesis
- final String hackTerm = term.replaceAll("\\(|\\)","");
-
- for (TokenMatch occurance : analysisResult.get(realTokenFQ)) {
-
- final Matcher m =occurance.getMatcher(hackTerm);
- evaluation = m.find() && m.start() == 0 && m.end() ==
hackTerm.length();
-
- // keep track of which TokenMatch's we've used.
- if (evaluation) {
- occurance.setTouched(true);
- break;
- }
- }
- }
-
- }
- return evaluation;
- }
-
- /** TODO comment me. **/
- public List<TokenMatch> reportToken(final TokenPredicate token, final
String query) {
-
- LOG.trace("reportToken(" + token + "," + query + ")");
-
- if (evaluateToken(token, null, query)) {
- final String realTokenFQ = getFastListName(token);
- return analysisResult.get(realTokenFQ);
- } else {
- return Collections.EMPTY_LIST;
- }
- }
-
- /**
* Search fast and find out if the given tokens are company, firstname,
lastname etc
* @param query
*/
@@ -302,11 +322,6 @@
}
}
- /** TODO comment me. **/
- public boolean isQueryDependant(final TokenPredicate predicate) {
- return predicate.name().startsWith(EXACT_PREFIX.toUpperCase());
- }
-
private void addMatch(final String name, final String match, final String
query) {
final String expr = "\\b" + match + "\\b";
final Pattern pattern = Pattern.compile(expr,
RegExpEvaluatorFactory.REG_EXP_OPTIONS);
@@ -348,4 +363,6 @@
final Map<TokenPredicate,String> listNames = LIST_NAMES.get(site);
return listNames.get(token);
}
+
+ // Inner classes -------------------------------------------------
}
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits