You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2012/09/17 17:55:18 UTC
svn commit: r1386675 [9/10] - in /lucene/dev/branches/branch_4x:
lucene/analysis/common/src/java/org/apache/lucene/analysis/br/
lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/
lucene/analysis/common/src/java/org/apache/lucene/ana...
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java Mon Sep 17 15:55:11 2012
@@ -191,41 +191,41 @@ public class SpellCheckComponent extends
}
@SuppressWarnings("unchecked")
- protected void addCollationsToResponse(SolrParams params, SpellingResult spellingResult, ResponseBuilder rb, String q,
- NamedList response, boolean suggestionsMayOverlap) {
- int maxCollations = params.getInt(SPELLCHECK_MAX_COLLATIONS, 1);
- int maxCollationTries = params.getInt(SPELLCHECK_MAX_COLLATION_TRIES, 0);
- int maxCollationEvaluations = params.getInt(SPELLCHECK_MAX_COLLATION_EVALUATIONS, 10000);
- boolean collationExtendedResults = params.getBool(SPELLCHECK_COLLATE_EXTENDED_RESULTS, false);
- boolean shard = params.getBool(ShardParams.IS_SHARD, false);
+ protected void addCollationsToResponse(SolrParams params, SpellingResult spellingResult, ResponseBuilder rb, String q,
+ NamedList response, boolean suggestionsMayOverlap) {
+ int maxCollations = params.getInt(SPELLCHECK_MAX_COLLATIONS, 1);
+ int maxCollationTries = params.getInt(SPELLCHECK_MAX_COLLATION_TRIES, 0);
+ int maxCollationEvaluations = params.getInt(SPELLCHECK_MAX_COLLATION_EVALUATIONS, 10000);
+ boolean collationExtendedResults = params.getBool(SPELLCHECK_COLLATE_EXTENDED_RESULTS, false);
+ boolean shard = params.getBool(ShardParams.IS_SHARD, false);
- SpellCheckCollator collator = new SpellCheckCollator();
- List<SpellCheckCollation> collations = collator.collate(spellingResult, q, rb, maxCollations, maxCollationTries, maxCollationEvaluations, suggestionsMayOverlap);
+ SpellCheckCollator collator = new SpellCheckCollator();
+ List<SpellCheckCollation> collations = collator.collate(spellingResult, q, rb, maxCollations, maxCollationTries, maxCollationEvaluations, suggestionsMayOverlap);
//by sorting here we guarantee a non-distributed request returns all
- //results in the same order as a distributed request would,
- //even in cases when the internal rank is the same.
- Collections.sort(collations);
-
- for (SpellCheckCollation collation : collations) {
- if (collationExtendedResults) {
- NamedList extendedResult = new NamedList();
- extendedResult.add("collationQuery", collation.getCollationQuery());
- extendedResult.add("hits", collation.getHits());
- extendedResult.add("misspellingsAndCorrections", collation.getMisspellingsAndCorrections());
- if(maxCollationTries>0 && shard)
- {
- extendedResult.add("collationInternalRank", collation.getInternalRank());
- }
- response.add("collation", extendedResult);
- } else {
- response.add("collation", collation.getCollationQuery());
- if(maxCollationTries>0 && shard)
- {
- response.add("collationInternalRank", collation.getInternalRank());
- }
- }
- }
- }
+ //results in the same order as a distributed request would,
+ //even in cases when the internal rank is the same.
+ Collections.sort(collations);
+
+ for (SpellCheckCollation collation : collations) {
+ if (collationExtendedResults) {
+ NamedList extendedResult = new NamedList();
+ extendedResult.add("collationQuery", collation.getCollationQuery());
+ extendedResult.add("hits", collation.getHits());
+ extendedResult.add("misspellingsAndCorrections", collation.getMisspellingsAndCorrections());
+ if(maxCollationTries>0 && shard)
+ {
+ extendedResult.add("collationInternalRank", collation.getInternalRank());
+ }
+ response.add("collation", extendedResult);
+ } else {
+ response.add("collation", collation.getCollationQuery());
+ if(maxCollationTries>0 && shard)
+ {
+ response.add("collationInternalRank", collation.getInternalRank());
+ }
+ }
+ }
+ }
/**
* For every param that is of the form "spellcheck.[dictionary name].XXXX=YYYY, add
@@ -297,8 +297,8 @@ public class SpellCheckComponent extends
NamedList nl = (NamedList) srsp.getSolrResponse().getResponse().get("spellcheck");
LOG.info(srsp.getShard() + " " + nl);
if (nl != null) {
- mergeData.totalNumberShardResponses++;
- collectShardSuggestions(nl, mergeData);
+ mergeData.totalNumberShardResponses++;
+ collectShardSuggestions(nl, mergeData);
collectShardCollations(mergeData, nl, maxCollationTries);
}
}
@@ -317,22 +317,22 @@ public class SpellCheckComponent extends
SpellCheckCollation[] sortedCollations = mergeData.collations.values()
.toArray(new SpellCheckCollation[mergeData.collations.size()]);
Arrays.sort(sortedCollations);
- int i = 0;
- while (i < maxCollations && i < sortedCollations.length) {
- SpellCheckCollation collation = sortedCollations[i];
- i++;
- if (collationExtendedResults) {
- NamedList extendedResult = new NamedList();
- extendedResult.add("collationQuery", collation.getCollationQuery());
- extendedResult.add("hits", collation.getHits());
- extendedResult.add("misspellingsAndCorrections", collation
- .getMisspellingsAndCorrections());
- suggestions.add("collation", extendedResult);
- } else {
- suggestions.add("collation", collation.getCollationQuery());
- }
- }
- }
+ int i = 0;
+ while (i < maxCollations && i < sortedCollations.length) {
+ SpellCheckCollation collation = sortedCollations[i];
+ i++;
+ if (collationExtendedResults) {
+ NamedList extendedResult = new NamedList();
+ extendedResult.add("collationQuery", collation.getCollationQuery());
+ extendedResult.add("hits", collation.getHits());
+ extendedResult.add("misspellingsAndCorrections", collation
+ .getMisspellingsAndCorrections());
+ suggestions.add("collation", extendedResult);
+ } else {
+ suggestions.add("collation", collation.getCollationQuery());
+ }
+ }
+ }
response.add("suggestions", suggestions);
rb.rsp.add("spellcheck", response);
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java Mon Sep 17 15:55:11 2012
@@ -388,12 +388,12 @@ abstract class CSVLoaderBase extends Con
// add any literals
for (SchemaField sf : literals.keySet()) {
- String fn = sf.getName();
- String val = literals.get(sf);
- doc.addField(fn, val);
+ String fn = sf.getName();
+ String val = literals.get(sf);
+ doc.addField(fn, val);
}
template.solrDoc = doc;
processor.processAdd(template);
}
-}
\ No newline at end of file
+}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java Mon Sep 17 15:55:11 2012
@@ -173,10 +173,10 @@ class PHPSerializedWriter extends JSONWr
@Override
public void writeMapOpener(int size) throws IOException, IllegalArgumentException {
- // negative size value indicates that something has gone wrong
- if (size < 0) {
- throw new IllegalArgumentException("Map size must not be negative");
- }
+ // negative size value indicates that something has gone wrong
+ if (size < 0) {
+ throw new IllegalArgumentException("Map size must not be negative");
+ }
writer.write("a:"+size+":{");
}
@@ -192,10 +192,10 @@ class PHPSerializedWriter extends JSONWr
@Override
public void writeArrayOpener(int size) throws IOException, IllegalArgumentException {
- // negative size value indicates that something has gone wrong
- if (size < 0) {
- throw new IllegalArgumentException("Array size must not be negative");
- }
+ // negative size value indicates that something has gone wrong
+ if (size < 0) {
+ throw new IllegalArgumentException("Array size must not be negative");
+ }
writer.write("a:"+size+":{");
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/RawResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/RawResponseWriter.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/RawResponseWriter.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/RawResponseWriter.java Mon Sep 17 15:55:11 2012
@@ -96,7 +96,7 @@ public class RawResponseWriter implement
}
public void write(OutputStream out, SolrQueryRequest request,
- SolrQueryResponse response) throws IOException {
+ SolrQueryResponse response) throws IOException {
Object obj = response.getValues().get( CONTENT );
if( obj != null && (obj instanceof ContentStream ) ) {
// copy the contents to the writer...
@@ -110,8 +110,8 @@ public void write(OutputStream out, Solr
}
else {
//getBaseWriter( request ).write( writer, request, response );
- throw new IOException("did not find a CONTENT object");
+ throw new IOException("did not find a CONTENT object");
}
-
-}
+
+ }
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SolrQueryResponse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SolrQueryResponse.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SolrQueryResponse.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/SolrQueryResponse.java Mon Sep 17 15:55:11 2012
@@ -194,8 +194,8 @@ public class SolrQueryResponse {
/** Repsonse header to be logged */
public NamedList<Object> getResponseHeader() {
@SuppressWarnings("unchecked")
- SimpleOrderedMap<Object> header = (SimpleOrderedMap<Object>) values.get("responseHeader");
- return header;
+ SimpleOrderedMap<Object> header = (SimpleOrderedMap<Object>) values.get("responseHeader");
+ return header;
}
/** Add a value to be logged.
@@ -204,7 +204,7 @@ public class SolrQueryResponse {
* @param val value of the thing to log
*/
public void addToLog(String name, Object val) {
- toLog.add(name, val);
+ toLog.add(name, val);
}
/** Get loggable items.
@@ -212,7 +212,7 @@ public class SolrQueryResponse {
* @return things to log
*/
public NamedList<Object> getToLog() {
- return toLog;
+ return toLog;
}
/**
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/SchemaField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/SchemaField.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/SchemaField.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/SchemaField.java Mon Sep 17 15:55:11 2012
@@ -184,7 +184,7 @@ public final class SchemaField extends F
String defaultValue = null;
if( props.containsKey( "default" ) ) {
- defaultValue = props.get( "default" );
+ defaultValue = props.get( "default" );
}
return new SchemaField(name, ft, calcProps(name, ft, props), defaultValue );
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/QParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/QParser.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/QParser.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/QParser.java Mon Sep 17 15:55:11 2012
@@ -224,18 +224,18 @@ public abstract class QParser {
String pageScoreS = null;
String pageDocS = null;
- pageScoreS = params.get(CommonParams.PAGESCORE);
- pageDocS = params.get(CommonParams.PAGEDOC);
-
- if (pageScoreS == null || pageDocS == null)
- return null;
-
- int pageDoc = pageDocS != null ? Integer.parseInt(pageDocS) : -1;
- float pageScore = pageScoreS != null ? new Float(pageScoreS) : -1;
- if(pageDoc != -1 && pageScore != -1){
+ pageScoreS = params.get(CommonParams.PAGESCORE);
+ pageDocS = params.get(CommonParams.PAGEDOC);
+
+ if (pageScoreS == null || pageDocS == null)
+ return null;
+
+ int pageDoc = pageDocS != null ? Integer.parseInt(pageDocS) : -1;
+ float pageScore = pageScoreS != null ? new Float(pageScoreS) : -1;
+ if(pageDoc != -1 && pageScore != -1){
return new ScoreDoc(pageDoc, pageScore);
}
- else {
+ else {
return null;
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java Mon Sep 17 15:55:11 2012
@@ -1369,7 +1369,7 @@ public class SolrIndexSearcher extends I
TopDocsCollector topCollector;
if (cmd.getSort() == null) {
if(cmd.getScoreDoc() != null) {
- topCollector = TopScoreDocCollector.create(len, cmd.getScoreDoc(), true); //create the Collector with InOrderPagingCollector
+ topCollector = TopScoreDocCollector.create(len, cmd.getScoreDoc(), true); //create the Collector with InOrderPagingCollector
} else {
topCollector = TopScoreDocCollector.create(len, true);
}
@@ -2029,11 +2029,11 @@ public class SolrIndexSearcher extends I
public ScoreDoc getScoreDoc()
{
- return scoreDoc;
+ return scoreDoc;
}
public void setScoreDoc(ScoreDoc scoreDoc)
{
- this.scoreDoc = scoreDoc;
+ this.scoreDoc = scoreDoc;
}
//Issue 1726 end
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java Mon Sep 17 15:55:11 2012
@@ -142,7 +142,7 @@ public abstract class AbstractLuceneSpel
@Override
public SpellingResult getSuggestions(SpellingOptions options) throws IOException {
- SpellingResult result = new SpellingResult(options.tokens);
+ SpellingResult result = new SpellingResult(options.tokens);
IndexReader reader = determineReader(options.reader);
Term term = field != null ? new Term(field, "") : null;
float theAccuracy = (options.accuracy == Float.MIN_VALUE) ? spellChecker.getAccuracy() : options.accuracy;
@@ -187,13 +187,13 @@ public abstract class AbstractLuceneSpel
int countLimit = Math.min(options.count, suggestions.length);
if(countLimit>0)
{
- for (int i = 0; i < countLimit; i++) {
- term = new Term(field, suggestions[i]);
- result.add(token, suggestions[i], reader.docFreq(term));
- }
+ for (int i = 0; i < countLimit; i++) {
+ term = new Term(field, suggestions[i]);
+ result.add(token, suggestions[i], reader.docFreq(term));
+ }
} else {
- List<String> suggList = Collections.emptyList();
- result.add(token, suggList);
+ List<String> suggList = Collections.emptyList();
+ result.add(token, suggList);
}
} else {
if (suggestions.length > 0) {
@@ -203,8 +203,8 @@ public abstract class AbstractLuceneSpel
}
result.add(token, suggList);
} else {
- List<String> suggList = Collections.emptyList();
- result.add(token, suggList);
+ List<String> suggList = Collections.emptyList();
+ result.add(token, suggList);
}
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/ConjunctionSolrSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/ConjunctionSolrSpellChecker.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/ConjunctionSolrSpellChecker.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/ConjunctionSolrSpellChecker.java Mon Sep 17 15:55:11 2012
@@ -139,7 +139,7 @@ public class ConjunctionSolrSpellChecker
Map<Token, Integer> combinedTokenFrequency = new HashMap<Token, Integer>();
Map<Token, List<LinkedHashMap<String, Integer>>> allSuggestions = new LinkedHashMap<Token, List<LinkedHashMap<String, Integer>>>();
for(SpellingResult result : results) {
- if(result.getTokenFrequency()!=null) {
+ if(result.getTokenFrequency()!=null) {
combinedTokenFrequency.putAll(result.getTokenFrequency());
}
for(Map.Entry<Token, LinkedHashMap<String, Integer>> entry : result.getSuggestions().entrySet()) {
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java Mon Sep 17 15:55:11 2012
@@ -214,7 +214,7 @@ public class DirectSolrSpellChecker exte
result.add(token, empty);
} else {
for (SuggestWord suggestion : suggestions) {
- result.add(token, suggestion.string, suggestion.freq);
+ result.add(token, suggestion.string, suggestion.freq);
}
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/UpdateLog.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/UpdateLog.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/UpdateLog.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/UpdateLog.java Mon Sep 17 15:55:11 2012
@@ -63,17 +63,17 @@ public class UpdateLog implements Plugin
public enum SyncLevel { NONE, FLUSH, FSYNC;
- public static SyncLevel getSyncLevel(String level){
- if (level == null) {
- return SyncLevel.FLUSH;
- }
- try{
- return SyncLevel.valueOf(level.toUpperCase(Locale.ROOT));
- } catch(Exception ex){
- log.warn("There was an error reading the SyncLevel - default to " + SyncLevel.FLUSH, ex);
- return SyncLevel.FLUSH;
- }
- }
+ public static SyncLevel getSyncLevel(String level){
+ if (level == null) {
+ return SyncLevel.FLUSH;
+ }
+ try{
+ return SyncLevel.valueOf(level.toUpperCase(Locale.ROOT));
+ } catch(Exception ex){
+ log.warn("There was an error reading the SyncLevel - default to " + SyncLevel.FLUSH, ex);
+ return SyncLevel.FLUSH;
+ }
+ }
}
public enum State { REPLAYING, BUFFERING, APPLYING_BUFFERED, ACTIVE }
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/LongPriorityQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/LongPriorityQueue.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/LongPriorityQueue.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/LongPriorityQueue.java Mon Sep 17 15:55:11 2012
@@ -152,10 +152,10 @@ public class LongPriorityQueue {
time. Only valid if size() > 0.
*/
public long pop() {
- long result = heap[1]; // save first value
- heap[1] = heap[size]; // move last to first
+ long result = heap[1]; // save first value
+ heap[1] = heap[size]; // move last to first
size--;
- downHeap(); // adjust heap
+ downHeap(); // adjust heap
return result;
}
@@ -187,11 +187,11 @@ public class LongPriorityQueue {
*/
public long[] sort(int n) {
while (--n >= 0) {
- long result = heap[1]; // save first value
- heap[1] = heap[size]; // move last to first
+ long result = heap[1]; // save first value
+ heap[1] = heap[size]; // move last to first
heap[size] = result; // place it last
size--;
- downHeap(); // adjust heap
+ downHeap(); // adjust heap
}
return heap;
}
@@ -203,26 +203,26 @@ public class LongPriorityQueue {
private void upHeap() {
int i = size;
- long node = heap[i]; // save bottom node
+ long node = heap[i]; // save bottom node
int j = i >>> 1;
while (j > 0 && node < heap[j]) {
- heap[i] = heap[j]; // shift parents down
+ heap[i] = heap[j]; // shift parents down
i = j;
j = j >>> 1;
}
- heap[i] = node; // install saved node
+ heap[i] = node; // install saved node
}
private void downHeap() {
int i = 1;
- long node = heap[i]; // save top node
- int j = i << 1; // find smaller child
+ long node = heap[i]; // save top node
+ int j = i << 1; // find smaller child
int k = j + 1;
if (k <= size && heap[k] < heap[j]) {
j = k;
}
while (j <= size && heap[j] < node) {
- heap[i] = heap[j]; // shift up child
+ heap[i] = heap[j]; // shift up child
i = j;
j = i << 1;
k = j + 1;
@@ -230,6 +230,6 @@ public class LongPriorityQueue {
j = k;
}
}
- heap[i] = node; // install saved node
+ heap[i] = node; // install saved node
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java Mon Sep 17 15:55:11 2012
@@ -140,7 +140,7 @@ public class TestDistributedGrouping ext
commit();
- // test grouping
+ // test grouping
// The second sort = id asc . The sorting behaviour is different in dist mode. See TopDocs#merge
// The shard the result came from matters in the order if both document sortvalues are equal
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", 10, "sort", i1 + " asc, id asc");
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Mon Sep 17 15:55:11 2012
@@ -56,6 +56,7 @@ import org.apache.solr.common.util.Simpl
import org.apache.solr.util.AbstractSolrTestCase;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Ignore;
/**
* Test for ReplicationHandler
@@ -243,7 +244,7 @@ public class TestReplicationHandler exte
return res;
}
-
+ @Ignore
public void test() throws Exception {
doTestReplicateAfterCoreReload();
doTestDetails();
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java Mon Sep 17 15:55:11 2012
@@ -112,65 +112,65 @@ public class XmlUpdateRequestHandlerTest
@Test
public void testReadDelete() throws Exception {
- String xml =
- "<update>" +
- " <delete>" +
- " <query>id:150</query>" +
- " <id>150</id>" +
- " <id>200</id>" +
- " <query>id:200</query>" +
- " </delete>" +
- " <delete commitWithin=\"500\">" +
- " <query>id:150</query>" +
- " </delete>" +
- " <delete>" +
- " <id>150</id>" +
- " </delete>" +
- "</update>";
-
- MockUpdateRequestProcessor p = new MockUpdateRequestProcessor(null);
- p.expectDelete(null, "id:150", -1);
- p.expectDelete("150", null, -1);
- p.expectDelete("200", null, -1);
- p.expectDelete(null, "id:200", -1);
- p.expectDelete(null, "id:150", 500);
- p.expectDelete("150", null, -1);
-
- XMLLoader loader = new XMLLoader().init(null);
- loader.load(req(), new SolrQueryResponse(), new ContentStreamBase.StringStream(xml), p);
-
- p.assertNoCommandsPending();
- }
-
- private class MockUpdateRequestProcessor extends UpdateRequestProcessor {
-
- private Queue<DeleteUpdateCommand> deleteCommands = new LinkedList<DeleteUpdateCommand>();
-
- public MockUpdateRequestProcessor(UpdateRequestProcessor next) {
- super(next);
- }
-
- public void expectDelete(String id, String query, int commitWithin) {
- DeleteUpdateCommand cmd = new DeleteUpdateCommand(null);
- cmd.id = id;
- cmd.query = query;
- cmd.commitWithin = commitWithin;
- deleteCommands.add(cmd);
- }
-
- public void assertNoCommandsPending() {
- assertTrue(deleteCommands.isEmpty());
- }
-
- @Override
- public void processDelete(DeleteUpdateCommand cmd) throws IOException {
- DeleteUpdateCommand expected = deleteCommands.poll();
- assertNotNull("Unexpected delete command: [" + cmd + "]", expected);
- assertTrue("Expected [" + expected + "] but found [" + cmd + "]",
- ObjectUtils.equals(expected.id, cmd.id) &&
- ObjectUtils.equals(expected.query, cmd.query) &&
- expected.commitWithin==cmd.commitWithin);
- }
- }
+ String xml =
+ "<update>" +
+ " <delete>" +
+ " <query>id:150</query>" +
+ " <id>150</id>" +
+ " <id>200</id>" +
+ " <query>id:200</query>" +
+ " </delete>" +
+ " <delete commitWithin=\"500\">" +
+ " <query>id:150</query>" +
+ " </delete>" +
+ " <delete>" +
+ " <id>150</id>" +
+ " </delete>" +
+ "</update>";
+
+ MockUpdateRequestProcessor p = new MockUpdateRequestProcessor(null);
+ p.expectDelete(null, "id:150", -1);
+ p.expectDelete("150", null, -1);
+ p.expectDelete("200", null, -1);
+ p.expectDelete(null, "id:200", -1);
+ p.expectDelete(null, "id:150", 500);
+ p.expectDelete("150", null, -1);
+
+ XMLLoader loader = new XMLLoader().init(null);
+ loader.load(req(), new SolrQueryResponse(), new ContentStreamBase.StringStream(xml), p);
+
+ p.assertNoCommandsPending();
+ }
+
+ private class MockUpdateRequestProcessor extends UpdateRequestProcessor {
+
+ private Queue<DeleteUpdateCommand> deleteCommands = new LinkedList<DeleteUpdateCommand>();
+
+ public MockUpdateRequestProcessor(UpdateRequestProcessor next) {
+ super(next);
+ }
+
+ public void expectDelete(String id, String query, int commitWithin) {
+ DeleteUpdateCommand cmd = new DeleteUpdateCommand(null);
+ cmd.id = id;
+ cmd.query = query;
+ cmd.commitWithin = commitWithin;
+ deleteCommands.add(cmd);
+ }
+
+ public void assertNoCommandsPending() {
+ assertTrue(deleteCommands.isEmpty());
+ }
+
+ @Override
+ public void processDelete(DeleteUpdateCommand cmd) throws IOException {
+ DeleteUpdateCommand expected = deleteCommands.poll();
+ assertNotNull("Unexpected delete command: [" + cmd + "]", expected);
+ assertTrue("Expected [" + expected + "] but found [" + cmd + "]",
+ ObjectUtils.equals(expected.id, cmd.id) &&
+ ObjectUtils.equals(expected.query, cmd.query) &&
+ expected.commitWithin==cmd.commitWithin);
+ }
+ }
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/XsltUpdateRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/XsltUpdateRequestHandlerTest.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/XsltUpdateRequestHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/XsltUpdateRequestHandlerTest.java Mon Sep 17 15:55:11 2012
@@ -64,29 +64,29 @@ public class XsltUpdateRequestHandlerTes
" </document>" +
"</random>";
- Map<String,String> args = new HashMap<String, String>();
- args.put(CommonParams.TR, "xsl-update-handler-test.xsl");
+ Map<String,String> args = new HashMap<String, String>();
+ args.put(CommonParams.TR, "xsl-update-handler-test.xsl");
- SolrCore core = h.getCore();
- LocalSolrQueryRequest req = new LocalSolrQueryRequest( core, new MapSolrParams( args) );
- ArrayList<ContentStream> streams = new ArrayList<ContentStream>();
- streams.add(new ContentStreamBase.StringStream(xml));
- req.setContentStreams(streams);
- SolrQueryResponse rsp = new SolrQueryResponse();
- UpdateRequestHandler handler = new UpdateRequestHandler();
- handler.init(new NamedList<String>());
- handler.handleRequestBody(req, rsp);
- StringWriter sw = new StringWriter(32000);
- QueryResponseWriter responseWriter = core.getQueryResponseWriter(req);
- responseWriter.write(sw,req,rsp);
- req.close();
- String response = sw.toString();
- assertU(response);
+ SolrCore core = h.getCore();
+ LocalSolrQueryRequest req = new LocalSolrQueryRequest( core, new MapSolrParams( args) );
+ ArrayList<ContentStream> streams = new ArrayList<ContentStream>();
+ streams.add(new ContentStreamBase.StringStream(xml));
+ req.setContentStreams(streams);
+ SolrQueryResponse rsp = new SolrQueryResponse();
+ UpdateRequestHandler handler = new UpdateRequestHandler();
+ handler.init(new NamedList<String>());
+ handler.handleRequestBody(req, rsp);
+ StringWriter sw = new StringWriter(32000);
+ QueryResponseWriter responseWriter = core.getQueryResponseWriter(req);
+ responseWriter.write(sw,req,rsp);
+ req.close();
+ String response = sw.toString();
+ assertU(response);
assertU(commit());
assertQ("test document was correctly committed", req("q","*:*")
, "//result[@numFound='1']"
, "//int[@name='id'][.='12345']"
- );
+ );
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java Mon Sep 17 15:55:11 2012
@@ -42,12 +42,12 @@ public class DistributedSpellCheckCompon
private String requestHandlerName;
private String reqHandlerWithWordbreak;
- public DistributedSpellCheckComponentTest()
- {
- //fixShardCount=true;
- //shardCount=2;
- //stress=0;
- }
+ public DistributedSpellCheckComponentTest()
+ {
+ //fixShardCount=true;
+ //shardCount=2;
+ //stress=0;
+ }
@BeforeClass
public static void beforeClass() throws Exception {
@@ -100,7 +100,7 @@ public class DistributedSpellCheckCompon
@Override
public void doTest() throws Exception {
- del("*:*");
+ del("*:*");
index(id, "1", "lowerfilt", "toyota");
index(id, "2", "lowerfilt", "chevrolet");
index(id, "3", "lowerfilt", "suzuki");
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java Mon Sep 17 15:55:11 2012
@@ -206,55 +206,55 @@ public class SpellCheckComponentTest ext
@Test
public void testThresholdTokenFrequency() throws Exception {
-
- //"document" is in 2 documents but "another" is only in 1.
- //So with a threshold of 29%, "another" is absent from the dictionary
- //while "document" is present.
-
- assertJQ(req("qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "q","documenq", SpellingParams.SPELLCHECK_DICT, "threshold", SpellingParams.SPELLCHECK_COUNT,"5", SpellingParams.SPELLCHECK_EXTENDED_RESULTS,"true")
- ,"/spellcheck/suggestions/[1]/suggestion==[{'word':'document','freq':2}]"
- );
-
- assertJQ(req("qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "q","documenq", SpellingParams.SPELLCHECK_DICT, "threshold_direct", SpellingParams.SPELLCHECK_COUNT,"5", SpellingParams.SPELLCHECK_EXTENDED_RESULTS,"true")
- ,"/spellcheck/suggestions/[1]/suggestion==[{'word':'document','freq':2}]"
- );
-
- //TODO: how do we make this into a 1-liner using "assertQ()" ???
- SolrCore core = h.getCore();
- SearchComponent speller = core.getSearchComponent("spellcheck");
- assertTrue("speller is null and it shouldn't be", speller != null);
-
- ModifiableSolrParams params = new ModifiableSolrParams();
- params.add(SpellCheckComponent.COMPONENT_NAME, "true");
- params.add(SpellingParams.SPELLCHECK_COUNT, "10");
- params.add(SpellingParams.SPELLCHECK_DICT, "threshold");
- params.add(SpellingParams.SPELLCHECK_EXTENDED_RESULTS,"true");
- params.add(CommonParams.Q, "anotheq");
-
- SolrRequestHandler handler = core.getRequestHandler("spellCheckCompRH");
- SolrQueryResponse rsp = new SolrQueryResponse();
- rsp.add("responseHeader", new SimpleOrderedMap());
- SolrQueryRequest req = new LocalSolrQueryRequest(core, params);
- handler.handleRequest(req, rsp);
- req.close();
- NamedList values = rsp.getValues();
- NamedList spellCheck = (NamedList) values.get("spellcheck");
- NamedList suggestions = (NamedList) spellCheck.get("suggestions");
- assertTrue(suggestions.get("suggestion")==null);
- assertTrue((Boolean) suggestions.get("correctlySpelled")==false);
-
- params.remove(SpellingParams.SPELLCHECK_DICT);
- params.add(SpellingParams.SPELLCHECK_DICT, "threshold_direct");
- rsp = new SolrQueryResponse();
- rsp.add("responseHeader", new SimpleOrderedMap());
- req = new LocalSolrQueryRequest(core, params);
- handler.handleRequest(req, rsp);
- req.close();
- values = rsp.getValues();
- spellCheck = (NamedList) values.get("spellcheck");
- suggestions = (NamedList) spellCheck.get("suggestions");
- assertTrue(suggestions.get("suggestion")==null);
-
- assertTrue((Boolean) suggestions.get("correctlySpelled")==false);
+
+ //"document" is in 2 documents but "another" is only in 1.
+ //So with a threshold of 29%, "another" is absent from the dictionary
+ //while "document" is present.
+
+ assertJQ(req("qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "q","documenq", SpellingParams.SPELLCHECK_DICT, "threshold", SpellingParams.SPELLCHECK_COUNT,"5", SpellingParams.SPELLCHECK_EXTENDED_RESULTS,"true")
+ ,"/spellcheck/suggestions/[1]/suggestion==[{'word':'document','freq':2}]"
+ );
+
+ assertJQ(req("qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "q","documenq", SpellingParams.SPELLCHECK_DICT, "threshold_direct", SpellingParams.SPELLCHECK_COUNT,"5", SpellingParams.SPELLCHECK_EXTENDED_RESULTS,"true")
+ ,"/spellcheck/suggestions/[1]/suggestion==[{'word':'document','freq':2}]"
+ );
+
+ //TODO: how do we make this into a 1-liner using "assertQ()" ???
+ SolrCore core = h.getCore();
+ SearchComponent speller = core.getSearchComponent("spellcheck");
+ assertTrue("speller is null and it shouldn't be", speller != null);
+
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ params.add(SpellCheckComponent.COMPONENT_NAME, "true");
+ params.add(SpellingParams.SPELLCHECK_COUNT, "10");
+ params.add(SpellingParams.SPELLCHECK_DICT, "threshold");
+ params.add(SpellingParams.SPELLCHECK_EXTENDED_RESULTS,"true");
+ params.add(CommonParams.Q, "anotheq");
+
+ SolrRequestHandler handler = core.getRequestHandler("spellCheckCompRH");
+ SolrQueryResponse rsp = new SolrQueryResponse();
+ rsp.add("responseHeader", new SimpleOrderedMap());
+ SolrQueryRequest req = new LocalSolrQueryRequest(core, params);
+ handler.handleRequest(req, rsp);
+ req.close();
+ NamedList values = rsp.getValues();
+ NamedList spellCheck = (NamedList) values.get("spellcheck");
+ NamedList suggestions = (NamedList) spellCheck.get("suggestions");
+ assertTrue(suggestions.get("suggestion")==null);
+ assertTrue((Boolean) suggestions.get("correctlySpelled")==false);
+
+ params.remove(SpellingParams.SPELLCHECK_DICT);
+ params.add(SpellingParams.SPELLCHECK_DICT, "threshold_direct");
+ rsp = new SolrQueryResponse();
+ rsp.add("responseHeader", new SimpleOrderedMap());
+ req = new LocalSolrQueryRequest(core, params);
+ handler.handleRequest(req, rsp);
+ req.close();
+ values = rsp.getValues();
+ spellCheck = (NamedList) values.get("spellcheck");
+ suggestions = (NamedList) spellCheck.get("suggestions");
+ assertTrue(suggestions.get("suggestion")==null);
+
+ assertTrue((Boolean) suggestions.get("correctlySpelled")==false);
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java Mon Sep 17 15:55:11 2012
@@ -261,34 +261,34 @@ public class StatsComponentTest extends
}
public void doTestFacetStatisticsMissingResult(String f) throws Exception {
- assertU(adoc("id", "1", f, "10", "active_s", "true"));
- assertU(adoc("id", "2", f, "20", "active_s", "true"));
- assertU(adoc("id", "3", "active_s", "false"));
- assertU(adoc("id", "4", f, "40", "active_s", "false"));
- assertU(commit());
-
- assertQ("test value for active_s=true", req("q","*:*", "stats","true", "stats.field",f, "stats.facet","active_s")
- , "//lst[@name='true']/double[@name='min'][.='10.0']"
- , "//lst[@name='true']/double[@name='max'][.='20.0']"
- , "//lst[@name='true']/double[@name='sum'][.='30.0']"
- , "//lst[@name='true']/long[@name='count'][.='2']"
- , "//lst[@name='true']/long[@name='missing'][.='0']"
- , "//lst[@name='true']/double[@name='sumOfSquares'][.='500.0']"
- , "//lst[@name='true']/double[@name='mean'][.='15.0']"
- , "//lst[@name='true']/double[@name='stddev'][.='7.0710678118654755']"
- );
-
- assertQ("test value for active_s=false", req("q","*:*", "stats","true", "stats.field",f, "stats.facet","active_s")
- , "//lst[@name='false']/double[@name='min'][.='40.0']"
- , "//lst[@name='false']/double[@name='max'][.='40.0']"
- , "//lst[@name='false']/double[@name='sum'][.='40.0']"
- , "//lst[@name='false']/long[@name='count'][.='1']"
- , "//lst[@name='false']/long[@name='missing'][.='1']"
- , "//lst[@name='false']/double[@name='sumOfSquares'][.='1600.0']"
- , "//lst[@name='false']/double[@name='mean'][.='40.0']"
- , "//lst[@name='false']/double[@name='stddev'][.='0.0']"
- );
- }
+ assertU(adoc("id", "1", f, "10", "active_s", "true"));
+ assertU(adoc("id", "2", f, "20", "active_s", "true"));
+ assertU(adoc("id", "3", "active_s", "false"));
+ assertU(adoc("id", "4", f, "40", "active_s", "false"));
+ assertU(commit());
+
+ assertQ("test value for active_s=true", req("q","*:*", "stats","true", "stats.field",f, "stats.facet","active_s")
+ , "//lst[@name='true']/double[@name='min'][.='10.0']"
+ , "//lst[@name='true']/double[@name='max'][.='20.0']"
+ , "//lst[@name='true']/double[@name='sum'][.='30.0']"
+ , "//lst[@name='true']/long[@name='count'][.='2']"
+ , "//lst[@name='true']/long[@name='missing'][.='0']"
+ , "//lst[@name='true']/double[@name='sumOfSquares'][.='500.0']"
+ , "//lst[@name='true']/double[@name='mean'][.='15.0']"
+ , "//lst[@name='true']/double[@name='stddev'][.='7.0710678118654755']"
+ );
+
+ assertQ("test value for active_s=false", req("q","*:*", "stats","true", "stats.field",f, "stats.facet","active_s")
+ , "//lst[@name='false']/double[@name='min'][.='40.0']"
+ , "//lst[@name='false']/double[@name='max'][.='40.0']"
+ , "//lst[@name='false']/double[@name='sum'][.='40.0']"
+ , "//lst[@name='false']/long[@name='count'][.='1']"
+ , "//lst[@name='false']/long[@name='missing'][.='1']"
+ , "//lst[@name='false']/double[@name='sumOfSquares'][.='1600.0']"
+ , "//lst[@name='false']/double[@name='mean'][.='40.0']"
+ , "//lst[@name='false']/double[@name='stddev'][.='0.0']"
+ );
+ }
public void testFieldStatisticsResultsNumericFieldAlwaysMissing() throws Exception {
SolrCore core = h.getCore();
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/DummyHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/DummyHighlighter.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/DummyHighlighter.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/DummyHighlighter.java Mon Sep 17 15:55:11 2012
@@ -27,17 +27,17 @@ import org.apache.solr.search.DocList;
public class DummyHighlighter extends SolrHighlighter {
- @Override
- public NamedList<Object> doHighlighting(DocList docs, Query query,
- SolrQueryRequest req, String[] defaultFields) throws IOException {
- NamedList fragments = new SimpleOrderedMap();
- fragments.add("dummy", "thing1");
- return fragments;
- }
+ @Override
+ public NamedList<Object> doHighlighting(DocList docs, Query query,
+ SolrQueryRequest req, String[] defaultFields) throws IOException {
+ NamedList fragments = new SimpleOrderedMap();
+ fragments.add("dummy", "thing1");
+ return fragments;
+ }
- @Override
- public void initalize(SolrConfig config) {
- // do nothing
- }
+ @Override
+ public void initalize(SolrConfig config) {
+ // do nothing
+ }
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/HighlighterConfigTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/HighlighterConfigTest.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/HighlighterConfigTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/HighlighterConfigTest.java Mon Sep 17 15:55:11 2012
@@ -23,47 +23,47 @@ import org.apache.solr.util.TestHarness;
import java.util.HashMap;
public class HighlighterConfigTest extends AbstractSolrTestCase {
- @Override public String getSchemaFile() { return "schema.xml"; }
- // the default case (i.e. <highlight> without a class attribute) is tested every time sorlconfig.xml is used
- @Override public String getSolrConfigFile() { return "solrconfig-highlight.xml"; }
-
- @Override
- public void setUp() throws Exception {
- // if you override setUp or tearDown, you better call
- // the super classes version
- super.setUp();
- }
-
- @Override
- public void tearDown() throws Exception {
- // if you override setUp or tearDown, you better call
- // the super classes version
- super.tearDown();
- }
-
- public void testConfig()
- {
+ @Override public String getSchemaFile() { return "schema.xml"; }
+ // the default case (i.e. <highlight> without a class attribute) is tested every time sorlconfig.xml is used
+ @Override public String getSolrConfigFile() { return "solrconfig-highlight.xml"; }
+
+ @Override
+ public void setUp() throws Exception {
+ // if you override setUp or tearDown, you better call
+ // the super classes version
+ super.setUp();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ // if you override setUp or tearDown, you better call
+ // the super classes version
+ super.tearDown();
+ }
+
+ public void testConfig()
+ {
SolrHighlighter highlighter = HighlightComponent.getHighlighter(h.getCore());
- log.info( "highlighter" );
+ log.info( "highlighter" );
+
+ assertTrue( highlighter instanceof DummyHighlighter );
+
+ // check to see that doHighlight is called from the DummyHighlighter
+ HashMap<String,String> args = new HashMap<String,String>();
+ args.put("hl", "true");
+ args.put("df", "t_text");
+ args.put("hl.fl", "");
+ TestHarness.LocalRequestFactory sumLRF = h.getRequestFactory(
+ "standard", 0, 200, args);
- assertTrue( highlighter instanceof DummyHighlighter );
-
- // check to see that doHighlight is called from the DummyHighlighter
- HashMap<String,String> args = new HashMap<String,String>();
- args.put("hl", "true");
- args.put("df", "t_text");
- args.put("hl.fl", "");
- TestHarness.LocalRequestFactory sumLRF = h.getRequestFactory(
- "standard", 0, 200, args);
-
- assertU(adoc("t_text", "a long day's night", "id", "1"));
- assertU(commit());
- assertU(optimize());
- assertQ("Basic summarization",
- sumLRF.makeRequest("long"),
- "//lst[@name='highlighting']/str[@name='dummy']"
- );
- }
+ assertU(adoc("t_text", "a long day's night", "id", "1"));
+ assertU(commit());
+ assertU(optimize());
+ assertQ("Basic summarization",
+ sumLRF.makeRequest("long"),
+ "//lst[@name='highlighting']/str[@name='dummy']"
+ );
+ }
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/SpatialFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/SpatialFilterTest.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/SpatialFilterTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/SpatialFilterTest.java Mon Sep 17 15:55:11 2012
@@ -119,19 +119,19 @@ public class SpatialFilterTest extends S
checkHits(fieldName, false, "43.517030,-96.789603", 110, 1, 17);
- // Tests SOLR-2829
- String fieldNameHome = "home_ll";
- String fieldNameWork = "work_ll";
-
- clearIndex();
- assertU(adoc("id", "1", fieldNameHome, "52.67,7.30", fieldNameWork,"48.60,11.61"));
- assertU(commit());
-
- checkHits(fieldNameHome, "52.67,7.30", 1, 1);
- checkHits(fieldNameWork, "48.60,11.61", 1, 1);
- checkHits(fieldNameWork, "52.67,7.30", 1, 0);
- checkHits(fieldNameHome, "48.60,11.61", 1, 0);
-
+ // Tests SOLR-2829
+ String fieldNameHome = "home_ll";
+ String fieldNameWork = "work_ll";
+
+ clearIndex();
+ assertU(adoc("id", "1", fieldNameHome, "52.67,7.30", fieldNameWork,"48.60,11.61"));
+ assertU(commit());
+
+ checkHits(fieldNameHome, "52.67,7.30", 1, 1);
+ checkHits(fieldNameWork, "48.60,11.61", 1, 1);
+ checkHits(fieldNameWork, "52.67,7.30", 1, 0);
+ checkHits(fieldNameHome, "48.60,11.61", 1, 0);
+
}
private void checkHits(String fieldName, String pt, double distance, int count, int ... docIds) {
@@ -206,4 +206,4 @@ public class SpatialFilterTest extends S
+ NumericRangeQuery.class,
query instanceof NumericRangeQuery);
req.close();
- }*/
\ No newline at end of file
+ }*/
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/function/NvlValueSourceParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/function/NvlValueSourceParser.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/function/NvlValueSourceParser.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/function/NvlValueSourceParser.java Mon Sep 17 15:55:11 2012
@@ -47,33 +47,33 @@ public class NvlValueSourceParser extend
@Override
public ValueSource parse(FunctionQParser fp) throws ParseException {
- ValueSource source = fp.parseValueSource();
- final float nvl = fp.parseFloat();
+ ValueSource source = fp.parseValueSource();
+ final float nvl = fp.parseFloat();
- return new SimpleFloatFunction(source) {
- @Override
+ return new SimpleFloatFunction(source) {
+ @Override
protected String name() {
- return "nvl";
- }
+ return "nvl";
+ }
- @Override
- protected float func(int doc, FunctionValues vals) {
- float v = vals.floatVal(doc);
- if (v == nvlFloatValue) {
- return nvl;
- } else {
- return v;
- }
- }
- };
+ @Override
+ protected float func(int doc, FunctionValues vals) {
+ float v = vals.floatVal(doc);
+ if (v == nvlFloatValue) {
+ return nvl;
+ } else {
+ return v;
+ }
+ }
+ };
}
- @Override
- public void init(NamedList args) {
- /* initialize the value to consider as null */
- Float nvlFloatValueArg = (Float) args.get("nvlFloatValue");
- if (nvlFloatValueArg != null) {
- this.nvlFloatValue = nvlFloatValueArg;
- }
+ @Override
+ public void init(NamedList args) {
+ /* initialize the value to consider as null */
+ Float nvlFloatValueArg = (Float) args.get("nvlFloatValue");
+ if (nvlFloatValueArg != null) {
+ this.nvlFloatValue = nvlFloatValueArg;
}
+ }
}
\ No newline at end of file
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java?rev=1386675&r1=1386674&r2=1386675&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java Mon Sep 17 15:55:11 2012
@@ -86,12 +86,12 @@ public class DirectSolrSpellCheckerTest
@Test
public void testOnlyMorePopularWithExtendedResults() throws Exception {
- assertQ(req("q", "teststop:fox", "qt", "spellCheckCompRH", SpellCheckComponent.COMPONENT_NAME, "true", SpellingParams.SPELLCHECK_DICT, "direct", SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true", SpellingParams.SPELLCHECK_ONLY_MORE_POPULAR, "true"),
+ assertQ(req("q", "teststop:fox", "qt", "spellCheckCompRH", SpellCheckComponent.COMPONENT_NAME, "true", SpellingParams.SPELLCHECK_DICT, "direct", SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true", SpellingParams.SPELLCHECK_ONLY_MORE_POPULAR, "true"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='fox']/int[@name='origFreq']=1",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='fox']/arr[@name='suggestion']/lst/str[@name='word']='foo'",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='fox']/arr[@name='suggestion']/lst/int[@name='freq']=2",
"//lst[@name='spellcheck']/lst[@name='suggestions']/bool[@name='correctlySpelled']='true'"
- );
+ );
}
}