Author: daniele
Date: 2007-01-24 08:50:23 +0100 (Wed, 24 Jan 2007)
New Revision: 4368
Modified:
trunk/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueAdsSearchCommand.java
Log:
AND between search terms instead of OR in ad-search
Modified:
trunk/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueAdsSearchCommand.java
===================================================================
---
trunk/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueAdsSearchCommand.java
2007-01-23 20:40:23 UTC (rev 4367)
+++
trunk/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueAdsSearchCommand.java
2007-01-24 07:50:23 UTC (rev 4368)
@@ -60,14 +60,7 @@
*/
protected void visitImpl(final LeafClause clause) {
-
-// subQuery1 += (subQuery1.length()>0?QL_AND:" ") + "
iypcfspkeywords1:"+clause.getTerm()+queryTwo;
-// subQuery2 += (subQuery2.length()>0?QL_AND:" ") + "
iypcfspkeywords2:"+clause.getTerm()+queryTwo;
-// subQuery3 += (subQuery3.length()>0?QL_AND:" ") + "
iypcfspkeywords3:"+clause.getTerm()+queryTwo;
-// subQuery4 += (subQuery4.length()>0?QL_AND:" ") + "
iypcfspkeywords4:"+clause.getTerm()+queryTwo;
-// subQuery5 += (subQuery5.length()>0?QL_AND:" ") + "
iypcfspkeywords5:"+clause.getTerm()+queryTwo;
-
- String term = clause.getTerm();
+ String term = getTransformedTerm(clause);
appendToQueryRepresentation("(");
appendToQueryRepresentation("( (iypcfspkeywords5:"+term+queryTwo+") OR
((iypcfspkeywords5:"+term+"ingensteds AND iypspgep5:ingensteds) ANDNOT
(iypcfspkeywords5:"+term+queryTwo+"))) OR");
appendToQueryRepresentation("( (iypcfspkeywords4:"+term+queryTwo+") OR
((iypcfspkeywords4:"+term+"ingensteds AND iypspgeo4:ingensteds) ANDNOT
(iypcfspkeywords4:"+term+queryTwo+"))) OR");
@@ -76,36 +69,4 @@
appendToQueryRepresentation("(
(iypcfspkeywords1:"+term+queryTwo+") OR ((iypcfspkeywords1:"+term+"ingensteds
AND iypspgeo1:ingensteds) ANDNOT (iypcfspkeywords1:"+term+queryTwo+")))");
appendToQueryRepresentation(")");
}
-
- /**
- * [EMAIL PROTECTED]
- */
- protected void visitImpl(final DefaultOperatorClause clause) {
- LOG.info("visitImpl DefaultOperatorClause");
- clause.getFirstClause().accept(this);
-
- final boolean hasEmptyLeaf = isEmptyLeaf(clause.getFirstClause()) ||
isEmptyLeaf(clause.getSecondClause());
-
- if (!(hasEmptyLeaf || clause.getSecondClause() instanceof NotClause)) {
- appendToQueryRepresentation("OR");
- }
-
- clause.getSecondClause().accept(this);
- }
-
- /**
- * Returns true iff the clause is a leaf clause and if it will not produce
any output in the query representation.
- *
- * @param clause The clause to examine.
- *
- * @return true iff leaf is empty.
- */
- private boolean isEmptyLeaf(final Clause clause) {
- if (clause instanceof LeafClause) {
- final LeafClause leafClause = (LeafClause) clause;
- return getFieldFilter(leafClause) != null ||
getTransformedTerm(clause).equals("");
- } else {
- return false;
- }
- }
}
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits