From 9e1ec5fec4d620bbab492ae84023ac6dcf0386df Mon Sep 17 00:00:00 2001 From: reger Date: Sun, 1 Feb 2015 04:26:33 +0100 Subject: [PATCH] refactor: just some more useages of constant for term ":[* TO *]" --- htroot/HostBrowser.java | 2 +- htroot/RankingSolr_p.java | 3 ++- source/net/yacy/cora/federate/solr/logic/CatchallLiteral.java | 2 +- source/net/yacy/search/schema/CollectionConfiguration.java | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htroot/HostBrowser.java b/htroot/HostBrowser.java index e7bd5f0c7..867ec1204 100644 --- a/htroot/HostBrowser.java +++ b/htroot/HostBrowser.java @@ -266,7 +266,7 @@ public class HostBrowser { ff.add(csf.getSolrFieldName()); } // add also vocabulary counters - Map> vocabularyFacet = sb.index.fulltext().getDefaultConnector().getFacets(CollectionSchema.vocabularies_sxt.getSolrFieldName() + ":[* TO *]", 100, CollectionSchema.vocabularies_sxt.getSolrFieldName()); + Map> vocabularyFacet = sb.index.fulltext().getDefaultConnector().getFacets(CollectionSchema.vocabularies_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM, 100, CollectionSchema.vocabularies_sxt.getSolrFieldName()); if (vocabularyFacet.size() > 0) { Collection vocnames = vocabularyFacet.values().iterator().next().keyList(true); for (String vocname: vocnames) { diff --git a/htroot/RankingSolr_p.java b/htroot/RankingSolr_p.java index 2bba0a23b..12d96807d 100644 --- a/htroot/RankingSolr_p.java +++ b/htroot/RankingSolr_p.java @@ -29,6 +29,7 @@ import java.util.Map.Entry; import net.yacy.cora.federate.solr.Ranking; import net.yacy.cora.federate.solr.SchemaDeclaration; +import net.yacy.cora.federate.solr.connector.AbstractSolrConnector; import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.sorting.ReversibleScoreMap; import net.yacy.cora.util.ConcurrentLog; @@ -172,7 +173,7 @@ public class RankingSolr_p { // make boost hints for vocabularies Map> vocabularyFacet; try { - vocabularyFacet = sb.index.fulltext().getDefaultConnector().getFacets(CollectionSchema.vocabularies_sxt.getSolrFieldName() + ":[* TO *]", 100, CollectionSchema.vocabularies_sxt.getSolrFieldName()); + vocabularyFacet = sb.index.fulltext().getDefaultConnector().getFacets(CollectionSchema.vocabularies_sxt.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM, 100, CollectionSchema.vocabularies_sxt.getSolrFieldName()); } catch (IOException e) { ConcurrentLog.logException(e); vocabularyFacet = new HashMap<>(); diff --git a/source/net/yacy/cora/federate/solr/logic/CatchallLiteral.java b/source/net/yacy/cora/federate/solr/logic/CatchallLiteral.java index dcd414fb2..1a9aa5e0d 100644 --- a/source/net/yacy/cora/federate/solr/logic/CatchallLiteral.java +++ b/source/net/yacy/cora/federate/solr/logic/CatchallLiteral.java @@ -59,7 +59,7 @@ public class CatchallLiteral extends Literal implements Term { public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.key.getSolrFieldName()); - sb.append(':').append(AbstractSolrConnector.CATCHALL_TERM); + sb.append(AbstractSolrConnector.CATCHALL_DTERM); return sb.toString(); } diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.java index c03c162eb..011086dc0 100644 --- a/source/net/yacy/search/schema/CollectionConfiguration.java +++ b/source/net/yacy/search/schema/CollectionConfiguration.java @@ -1315,13 +1315,13 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri if (count > 0) { Map> partitioningFacet = collectionConnector.getFacets("{!cache=false}" + collection1query, 100000, partitioningKey); ReversibleScoreMap partitioning = partitioningFacet.get(partitioningKey); - long emptyCount = collectionConnector.getCountByQuery("{!cache=false}" + "-" + partitioningKey + ":[* TO *] AND (" + collection1query + ")"); + long emptyCount = collectionConnector.getCountByQuery("{!cache=false}" + "-" + partitioningKey + AbstractSolrConnector.CATCHALL_DTERM + " AND (" + collection1query + ")"); if (emptyCount > 0) partitioning.inc("", (int) emptyCount); final long start = System.currentTimeMillis(); List querystrings = new ArrayList<>(partitioning.size()); for (String partitioningValue: partitioning) { String partitioningQuery = "{!cache=false}" + ((partitioningValue.length() == 0) ? - "-" + partitioningKey + ":[* TO *] AND (" + collection1query + ")" : + "-" + partitioningKey + AbstractSolrConnector.CATCHALL_DTERM + " AND (" + collection1query + ")" : partitioningKey + ":" + partitioningValue + " AND (" + collection1query + ")"); querystrings.add(partitioningQuery); }